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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-12-13 08:33:33 +00:00
parent 5ae9cebef5
commit 21a55c9f08

View File

@ -2172,11 +2172,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
// formed. // formed.
CastInst *BoolCast = 0; CastInst *BoolCast = 0;
if (CastInst *CI = dyn_cast<CastInst>(I.getOperand(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; BoolCast = CI;
if (!BoolCast) if (!BoolCast)
if (CastInst *CI = dyn_cast<CastInst>(I.getOperand(1))) 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; BoolCast = CI;
if (BoolCast) { if (BoolCast) {
if (SetCondInst *SCI = dyn_cast<SetCondInst>(BoolCast->getOperand(0))) { if (SetCondInst *SCI = dyn_cast<SetCondInst>(BoolCast->getOperand(0))) {