[llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp

Owen Anderson resistor at mac.com
Mon Jun 12 00:10:29 PDT 2006



Changes in directory llvm/lib/Transforms/Utils:

LCSSA.cpp updated: 1.19 -> 1.20
---
Log message:

Fix for 2006-06-26-MultipleExitsSingleBlock.

If a single exit block has multiple predecessors within the loop, it will
appear in the exit blocks list more than once.  LCSSA needs to take that into
account so that it doesn't double process that exit block.


---
Diffs of the changes:  (+7 -4)

 LCSSA.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Utils/LCSSA.cpp
diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.19 llvm/lib/Transforms/Utils/LCSSA.cpp:1.20
--- llvm/lib/Transforms/Utils/LCSSA.cpp:1.19	Sun Jun 11 14:22:28 2006
+++ llvm/lib/Transforms/Utils/LCSSA.cpp	Mon Jun 12 02:10:16 2006
@@ -155,13 +155,16 @@
   std::vector<PHINode*> workList;
   
   for (std::vector<BasicBlock*>::const_iterator BBI = exitBlocks.begin(),
-      BBE = exitBlocks.end(); BBI != BBE; ++BBI)
-    if (DT->getNode(Instr->getParent())->dominates(DT->getNode(*BBI))) {
-      PHINode *phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
+      BBE = exitBlocks.end(); BBI != BBE; ++BBI) {
+    Instruction*& phi = Phis[*BBI];
+    if (phi == 0 &&
+        DT->getNode(Instr->getParent())->dominates(DT->getNode(*BBI))) {
+      phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
                                  (*BBI)->begin());
-      workList.push_back(phi);
+      workList.push_back(cast<PHINode>(phi));
       Phis[*BBI] = phi;
     }
+  }
   
   // Phi nodes that need to have their incoming values filled.
   std::vector<PHINode*> needIncomingValues;






More information about the llvm-commits mailing list