Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913

llvm-svn: 30405
This commit is contained in:
Chris Lattner 2006-09-16 03:14:10 +00:00
parent 5772ba4f50
commit 850465d53f
1 changed files with 5 additions and 0 deletions

View File

@ -1011,6 +1011,11 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
// If this is an integer truncate or noop, just look in the input.
if (SrcTy->getPrimitiveSizeInBits() >=
I->getType()->getPrimitiveSizeInBits()) {
// Cast to bool is a comparison against 0, which demands all bits. We
// can't propagate anything useful up.
if (I->getType() == Type::BoolTy)
break;
if (SimplifyDemandedBits(I->getOperand(0), DemandedMask,
KnownZero, KnownOne, Depth+1))
return true;