aboutsummaryrefslogtreecommitdiff
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
commitf6bd07c7fe954f7676751d06a420995d2ab5b136 (patch)
treeb5d24cc4c98fa744b13714b494c23a14f8213b55
parente5833b3215af5c6ce0b83b28abfa4ed30c1120de (diff)
Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30405 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 6961806bcb..c803a18a35 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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;