summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
-rw-r--r--test/Transforms/InstCombine/mul.ll5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 838b33c..864b2fa 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2702,7 +2702,8 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
Context->getConstantInt(Op0->getType(), Val.logBase2()));
}
} else if (isa<VectorType>(Op1->getType())) {
- // TODO: If Op1 is all zeros and Op0 is all finite, return all zeros.
+ if (Op1->isNullValue())
+ return ReplaceInstUsesWith(I, Op1);
if (ConstantVector *Op1V = dyn_cast<ConstantVector>(Op1)) {
if (Op1V->isAllOnesValue()) // X * -1 == 0 - X
diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll
index 9b5f7a5..cd13803 100644
--- a/test/Transforms/InstCombine/mul.ll
+++ b/test/Transforms/InstCombine/mul.ll
@@ -83,3 +83,8 @@ define internal void @test13(<4 x float>*) {
store <4 x float> %3, <4 x float>* %0, align 1
ret void
}
+
+define <16 x i8> @test14(<16 x i8> %a) {
+ %b = mul <16 x i8> %a, zeroinitializer
+ ret <16 x i8> %b
+}