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

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 22 15:55:12 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopUnswitch.cpp updated: 1.34 -> 1.35
---
Log message:

Fix Regression/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll, which
caused SPASS to fail building last night.

We can't trivially unswitch a loop if the exit block has phi nodes in it,
because we don't know which predecessor to use.



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

 LoopUnswitch.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.34 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.35
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.34	Wed Feb 22 00:37:14 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Wed Feb 22 17:55:00 2006
@@ -325,7 +325,9 @@
       }
   }
 
-  if (!LoopExitBB)
+  // If we didn't find a single unique LoopExit block, or if the loop exit block
+  // contains phi nodes, this isn't trivial.
+  if (!LoopExitBB || isa<PHINode>(LoopExitBB->begin()))
     return false;   // Can't handle this.
   
   if (LoopExit) *LoopExit = LoopExitBB;






More information about the llvm-commits mailing list