diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 85fcbcccb2c..da0495c340b 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -930,7 +930,7 @@ static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q, return X; // i1 mul -> and. - if (MaxRecurse && Op0->getType()->isIntegerTy(1)) + if (MaxRecurse && Op0->getType()->getScalarType()->isIntegerTy(1)) if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1)) return V; diff --git a/test/Transforms/InstSimplify/mul.ll b/test/Transforms/InstSimplify/mul.ll new file mode 100644 index 00000000000..0bf8f699a68 --- /dev/null +++ b/test/Transforms/InstSimplify/mul.ll @@ -0,0 +1,11 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instsimplify -S | FileCheck %s + +define <2 x i1> @test1(<2 x i1> %a) { +; CHECK-LABEL: @test1( +; CHECK-NEXT: ret <2 x i1> zeroinitializer +; + %b = and <2 x i1> %a, + %res = mul <2 x i1> %b, + ret <2 x i1> %res +}