summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-16 03:14:10 +0000
committerChris Lattner <sabre@nondot.org>2006-09-16 03:14:10 +0000
commit850465d53fbd1eda454a609266c64c5146ca7e42 (patch)
tree08c3b45e8d557543abcf44686cb690821481f495 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent5772ba4f5003628a87a99e3943519d869f4c9b06 (diff)
downloadbcm5719-llvm-850465d53fbd1eda454a609266c64c5146ca7e42.tar.gz
bcm5719-llvm-850465d53fbd1eda454a609266c64c5146ca7e42.zip
Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913
llvm-svn: 30405
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 6961806bcb7..c803a18a358 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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;
OpenPOWER on IntegriCloud