Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913
authorChris Lattner <sabre@nondot.org>
Sat, 16 Sep 2006 03:14:10 +0000 (03:14 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 16 Sep 2006 03:14:10 +0000 (03:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30405 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 6961806bcb79b05d8ff37c0c5bb5869dbb7e7c1d..c803a18a3588b380ef990d33e7bfe0d4d3f055a2 100644 (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;