diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-06-05 22:03:53 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-06-05 22:03:53 +0000 |
commit | a1a9f408dadefb157d1204f72200936f013521fd (patch) | |
tree | 1350633d35e51d955dd80aaabda2b2a7a0322101 /lib/CodeGen/IfConversion.cpp | |
parent | e004317c66651a7bf8cdea7c15060c1f357c0e3e (diff) | |
download | external_llvm-a1a9f408dadefb157d1204f72200936f013521fd.zip external_llvm-a1a9f408dadefb157d1204f72200936f013521fd.tar.gz external_llvm-a1a9f408dadefb157d1204f72200936f013521fd.tar.bz2 |
ReplaceUsesOfBlockWith() can modify the predecessors list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index 9a35d1d..e06fb26 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -756,9 +756,10 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI) { 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); |