Fix Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll
authorChris Lattner <sabre@nondot.org>
Thu, 4 May 2006 17:33:35 +0000 (17:33 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 4 May 2006 17:33:35 +0000 (17:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28101 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 7e9c3841cce74b58fb3b2af128ea8847fea4d9bb..dfd568c33e11425bfc23ebf8a7dd3aa6ab2d1dea 100644 (file)
@@ -456,6 +456,8 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero,
   Instruction *I = dyn_cast<Instruction>(V);
   if (!I) return;
 
+  Mask &= V->getType()->getIntegralTypeMask();
+  
   switch (I->getOpcode()) {
   case Instruction::And:
     // If either the LHS or the RHS are Zero, the result is zero.
@@ -713,6 +715,8 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
   Instruction *I = dyn_cast<Instruction>(V);
   if (!I) return false;        // Only analyze instructions.
 
+  DemandedMask &= V->getType()->getIntegralTypeMask();
+  
   uint64_t KnownZero2, KnownOne2;
   switch (I->getOpcode()) {
   default: break;