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

Chris Lattner lattner at cs.uiuc.edu
Fri Mar 26 10:12:01 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.174 -> 1.175

---
Log message:

X % -1 == X % 1 == 0


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

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.174 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.175
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.174	Thu Mar 25 16:59:29 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Mar 26 10:11:24 2004
@@ -808,6 +808,8 @@
   if (ConstantInt *RHS = dyn_cast<ConstantInt>(I.getOperand(1))) {
     if (RHS->equalsInt(1))  // X % 1 == 0
       return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
+    if (RHS->isAllOnesValue())  // X % -1 == 0
+      return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
 
     // Check to see if this is an unsigned remainder with an exact power of 2,
     // if so, convert to a bitwise and.





More information about the llvm-commits mailing list