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

Chris Lattner lattner at cs.uiuc.edu
Wed Jun 28 10:35:02 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.492 -> 1.493
---
Log message:

Fix Transforms/InstCombine/2006-06-28-infloop.ll


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

 InstructionCombining.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.492 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.493
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.492	Tue Jun 27 20:01:52 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Jun 28 12:34:50 2006
@@ -4934,6 +4934,12 @@
     // If this is a cast from the destination type, we can trivially eliminate
     // it, and this will remove a cast overall.
     if (I->getOperand(0)->getType() == Ty) {
+      // If the first operand is itself a cast, and is eliminable, do not count
+      // this as an eliminable cast.  We would prefer to eliminate those two
+      // casts first.
+      if (CastInst *OpCast = dyn_cast<CastInst>(I->getOperand(0)))
+        return true;
+      
       ++NumCastsRemoved;
       return true;
     }






More information about the llvm-commits mailing list