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

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 5 11:32:01 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.140 -> 1.141

---
Log message:

Fix flawed logic that was breaking several SPEC benchmarks, including gzip and crafty.


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

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.140 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.141
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.140	Tue Nov  4 19:06:05 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Nov  5 11:31:36 2003
@@ -1337,8 +1337,8 @@
         // because the source would be zero extended.
         unsigned SrcBits =
           SrcTy == Type::BoolTy ? 1 : SrcTy->getPrimitiveSize()*8;
-        bool HasSignBit = 1ULL << (DestTy->getPrimitiveSize()*8-1);
-        if (ConstVal & ((1ULL << SrcBits)-1)) {
+        bool HasSignBit = ConstVal & (1ULL << (DestTy->getPrimitiveSize()*8-1));
+        if (ConstVal & ~((1ULL << SrcBits)-1)) {
           switch (I.getOpcode()) {
           default: assert(0 && "Unknown comparison type!");
           case Instruction::SetEQ:
@@ -1655,7 +1655,7 @@
         unsigned AllocElTySize = TD->getTypeSize(AllocElTy);
         const Type *CastElTy = PTy->getElementType();
         unsigned CastElTySize = TD->getTypeSize(CastElTy);
-        
+
         // If the allocation is for an even multiple of the cast type size
         if (CastElTySize && (AllocElTySize % CastElTySize == 0)) {
           Value *Amt = ConstantUInt::get(Type::UIntTy, 





More information about the llvm-commits mailing list