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

Chris Lattner sabre at nondot.org
Tue Mar 13 07:27:59 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.658 -> 1.659
---
Log message:

ifdef out some dead code.

Fix PR1244: http://llvm.org/PR1244  and Transforms/InstCombine/2007-03-13-CompareMerge.ll


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

 InstructionCombining.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.658 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.659
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.658	Tue Mar 13 01:40:59 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Mar 13 09:27:42 2007
@@ -992,6 +992,7 @@
   return (KnownZero & Mask) == Mask;
 }
 
+#if 0
 /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero.  We use
 /// this predicate to simplify operations downstream.  Mask is known to be zero
 /// for bits that V cannot have.
@@ -1001,6 +1002,7 @@
   assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); 
   return (KnownZero & Mask) == Mask;
 }
+#endif
 
 /// ShrinkDemandedConstant - Check to see if the specified operand of the 
 /// specified instruction is a constant integer.  If so, check to see if there
@@ -3608,8 +3610,9 @@
       ICI->swapOperands();  // Swap the LHS and RHS of the ICmp
     }
 
+    ICmpInst *RHSICI = cast<ICmpInst>(Log.getOperand(1));
     unsigned LHSCode = getICmpCode(ICI);
-    unsigned RHSCode = getICmpCode(cast<ICmpInst>(Log.getOperand(1)));
+    unsigned RHSCode = getICmpCode(RHSICI);
     unsigned Code;
     switch (Log.getOpcode()) {
     case Instruction::And: Code = LHSCode & RHSCode; break;
@@ -3618,7 +3621,10 @@
     default: assert(0 && "Illegal logical opcode!"); return 0;
     }
 
-    Value *RV = getICmpValue(ICmpInst::isSignedPredicate(pred), Code, LHS, RHS);
+    bool isSigned = ICmpInst::isSignedPredicate(RHSICI->getPredicate()) || 
+                    ICmpInst::isSignedPredicate(ICI->getPredicate());
+      
+    Value *RV = getICmpValue(isSigned, Code, LHS, RHS);
     if (Instruction *I = dyn_cast<Instruction>(RV))
       return I;
     // Otherwise, it's a constant boolean value...






More information about the llvm-commits mailing list