diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 232e504971c..68089c2dd36 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2172,11 +2172,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { // formed. CastInst *BoolCast = 0; if (CastInst *CI = dyn_cast(I.getOperand(0))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::BoolTy && + CI->getOpcode() == Instruction::ZExt) BoolCast = CI; if (!BoolCast) if (CastInst *CI = dyn_cast(I.getOperand(1))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::BoolTy && + CI->getOpcode() == Instruction::ZExt) BoolCast = CI; if (BoolCast) { if (SetCondInst *SCI = dyn_cast(BoolCast->getOperand(0))) {