[llvm-commits] [llvm] r60652 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp

Owen Anderson resistor at mac.com
Sat Dec 6 21:33:20 PST 2008


Author: resistor
Date: Sat Dec  6 23:33:18 2008
New Revision: 60652

URL: http://llvm.org/viewvc/llvm-project?rev=60652&view=rev
Log:
Switch to top-down mode and fix a crasher this exposed caused by an error in the
live interval updating.

Modified:
    llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp

Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=60652&r1=60651&r2=60652&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sat Dec  6 23:33:18 2008
@@ -442,6 +442,9 @@
          SE = MBB->succ_end(); SI != SE; ++SI)
     WorkList.push_back(*SI);
 
+  SmallPtrSet<MachineBasicBlock*, 4> ProcessedBlocks;
+  ProcessedBlocks.insert(MBB);
+
   while (!WorkList.empty()) {
     MBB = WorkList.back();
     WorkList.pop_back();
@@ -459,6 +462,13 @@
       }
       Processed.insert(LR);
     }
+    
+    ProcessedBlocks.insert(MBB);
+    if (LR)
+      for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(),
+            SE = MBB->succ_end(); SI != SE; ++SI)
+        if (!ProcessedBlocks.count(*SI))
+          WorkList.push_back(*SI);
   }
 
   for (LiveInterval::iterator I = CurrLI->begin(), E = CurrLI->end();
@@ -1039,7 +1049,7 @@
   // Make sure blocks are numbered in order.
   MF.RenumberBlocks();
 
-#if 0
+#if 1
   // FIXME: Go top down.
   MachineBasicBlock *Entry = MF.begin();
   SmallPtrSet<MachineBasicBlock*,16> Visited;





More information about the llvm-commits mailing list