For mul transforms, when checking for a cast from bool as either operand,
make sure to also check that it is a zext from bool, not any other cast
operation type.
llvm-svn: 32539
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 232e504..68089c2 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2172,11 +2172,13 @@
// formed.
CastInst *BoolCast = 0;
if (CastInst *CI = dyn_cast<CastInst>(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<CastInst>(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<SetCondInst>(BoolCast->getOperand(0))) {