[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 7 17:20:35 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.423 -> 1.424
---
Log message:

Fix a problem in my patch yesterday, causing a miscompilation of 176.gcc


---
Diffs of the changes:  (+3 -2)

 InstructionCombining.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.423 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.424
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.423	Tue Feb  7 13:07:40 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Feb  7 19:20:23 2006
@@ -464,7 +464,7 @@
       // (shl X, C1) & C2 == 0   iff   (X & C2 >>u C1) == 0
       if (ConstantUInt *SA = dyn_cast<ConstantUInt>(I->getOperand(1)))
         return ComputeMaskedNonZeroBits(I->getOperand(0),Mask >> SA->getValue(), 
-                                        Depth+1);
+                                        Depth+1) << SA->getValue();
       break;
     case Instruction::Shr:
       // (ushr X, C1) & C2 == 0   iff  (-1 >> C1) & C2 == 0
@@ -472,7 +472,8 @@
         if (I->getType()->isUnsigned()) {
           Mask <<= SA->getValue();
           Mask &= I->getType()->getIntegralTypeMask();
-          return ComputeMaskedNonZeroBits(I->getOperand(0), Mask, Depth+1);
+          return ComputeMaskedNonZeroBits(I->getOperand(0), Mask, Depth+1)
+                      >> SA->getValue();
         }
       break;
     }






More information about the llvm-commits mailing list