[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

Evan Cheng evan.cheng at apple.com
Tue Jun 5 15:04:15 PDT 2007



Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.27 -> 1.28
---
Log message:

ReplaceUsesOfBlockWith() can modify the predecessors list.

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

 IfConversion.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.27 llvm/lib/CodeGen/IfConversion.cpp:1.28
--- llvm/lib/CodeGen/IfConversion.cpp:1.27	Tue Jun  5 15:38:42 2007
+++ llvm/lib/CodeGen/IfConversion.cpp	Tue Jun  5 17:03:53 2007
@@ -756,9 +756,10 @@
     ToBBI.BB->removeSuccessor(FromBBI.BB);
 
   // Redirect all branches to FromBB to ToBB.
-  for (MachineBasicBlock::pred_iterator I = FromBBI.BB->pred_begin(),
-         E = FromBBI.BB->pred_end(); I != E; ++I)
-    (*I)->ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB);
+  std::vector<MachineBasicBlock *> Preds(FromBBI.BB->pred_begin(),
+                                         FromBBI.BB->pred_end());
+  for (unsigned i = 0, e = Preds.size(); i != e; ++i)
+    Preds[i]->ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB);
 
   // Transfer preds / succs and update size.
   TransferPreds(ToBBI.BB, FromBBI.BB);






More information about the llvm-commits mailing list