Fix trivial todo in instcombine.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 14 Jul 2009 02:01:53 +0000 (02:01 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 14 Jul 2009 02:01:53 +0000 (02:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75586 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/mul.ll

index 838b33cb23c7e84f07585122f8781dd17dd7d2e7..864b2fa5ee050f79871514d68afec0a15094cf35 100644 (file)
@@ -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
index 9b5f7a5c5efc8eea22d739f6b66ef3febc8de5ce..cd13803d3103577fb765650a1f6344dd5f0900f4 100644 (file)
@@ -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
+}