projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
089aef4
)
[NFC][CodeGen] Use while loop instead for loop in MachineBlockPlacement::optimizeBran...
author
Kang Zhang
<shkzhang@cn.ibm.com>
Sun, 11 Aug 2019 12:58:50 +0000
(12:58 +0000)
committer
Kang Zhang
<shkzhang@cn.ibm.com>
Sun, 11 Aug 2019 12:58:50 +0000
(12:58 +0000)
This will pass EXPENSIVE check.
llvm-svn: 368532
llvm/lib/CodeGen/MachineBlockPlacement.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index
2f4060a
..
3fd72b9
100644
(file)
--- a/
llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/
llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@
-2789,9
+2789,10
@@
void MachineBlockPlacement::optimizeBranches() {
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));