[llvm] r368532 - [NFC][CodeGen] Use while loop instead for loop in MachineBlockPlacement::optimizeBranches()
Kang Zhang via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 11 05:58:50 PDT 2019
Author: zhangkang
Date: Sun Aug 11 05:58:50 2019
New Revision: 368532
URL: http://llvm.org/viewvc/llvm-project?rev=368532&view=rev
Log:
[NFC][CodeGen] Use while loop instead for loop in MachineBlockPlacement::optimizeBranches()
This will pass EXPENSIVE check.
Modified:
llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=368532&r1=368531&r2=368532&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Sun Aug 11 05:58:50 2019
@@ -2789,9 +2789,10 @@ void MachineBlockPlacement::optimizeBran
ChainBB->removeSuccessor(TBB);
// Update the CFG.
- for (MachineBasicBlock::pred_iterator PI = TBB->pred_begin(),
- PE = TBB->pred_end(); PI != PE; ++PI)
- (*PI)->ReplaceUsesOfBlockWith(TBB, ChainBB);
+ while (!TBB->pred_empty()) {
+ MachineBasicBlock *Pred = *(TBB->pred_end()-1);
+ Pred->ReplaceUsesOfBlockWith(TBB, ChainBB);
+ }
for (MachineBasicBlock *Succ : TBB->successors())
ChainBB->addSuccessor(Succ, MBPI->getEdgeProbability(TBB, Succ));
More information about the llvm-commits
mailing list