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

Chris Lattner sabre at nondot.org
Fri Feb 23 17:04:02 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.636 -> 1.637
---
Log message:

Fix InstCombine/2007-02-23-PhiFoldInfLoop.ll and PR1217: http://llvm.org/PR1217 


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

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


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.636 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.637
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.636	Thu Feb 15 16:52:10 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Feb 23 19:03:45 2007
@@ -1641,11 +1641,12 @@
 
   // Check to see if all of the operands of the PHI are constants.  If there is
   // one non-constant value, remember the BB it is.  If there is more than one
-  // bail out.
+  // or if *it* is a PHI, bail out.
   BasicBlock *NonConstBB = 0;
   for (unsigned i = 0; i != NumPHIValues; ++i)
     if (!isa<Constant>(PN->getIncomingValue(i))) {
       if (NonConstBB) return 0;  // More than one non-const value.
+      if (isa<PHINode>(PN->getIncomingValue(i))) return 0;  // Itself a phi.
       NonConstBB = PN->getIncomingBlock(i);
       
       // If the incoming non-constant value is in I's block, we have an infinite






More information about the llvm-commits mailing list