mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-02 09:33:59 +00:00
iterate over preds using PHI information when available instead of
using pred_begin/end. It is much faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3f65b5e733
commit
2f36ea8b74
@ -229,9 +229,18 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
||||
// loop header) then NewBB dominates DestBB.
|
||||
SmallVector<BasicBlock*, 8> OtherPreds;
|
||||
|
||||
for (pred_iterator I = pred_begin(DestBB), E = pred_end(DestBB); I != E; ++I)
|
||||
if (*I != NewBB)
|
||||
OtherPreds.push_back(*I);
|
||||
// If there is a PHI in the block, loop over predecessors with it, which is
|
||||
// faster than iterating pred_begin/end.
|
||||
if (PHINode *PN = dyn_cast<PHINode>(DestBB->begin())) {
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||
if (PN->getIncomingBlock(i) != NewBB)
|
||||
OtherPreds.push_back(PN->getIncomingBlock(i));
|
||||
} else {
|
||||
for (pred_iterator I = pred_begin(DestBB), E = pred_end(DestBB);
|
||||
I != E; ++I)
|
||||
if (*I != NewBB)
|
||||
OtherPreds.push_back(*I);
|
||||
}
|
||||
|
||||
bool NewBBDominatesDestBB = true;
|
||||
|
||||
@ -382,9 +391,8 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
||||
}
|
||||
|
||||
// Update ProfileInfo if it is around.
|
||||
if (ProfileInfo *PI = P->getAnalysisIfAvailable<ProfileInfo>()) {
|
||||
PI->splitEdge(TIBB,DestBB,NewBB,MergeIdenticalEdges);
|
||||
}
|
||||
if (ProfileInfo *PI = P->getAnalysisIfAvailable<ProfileInfo>())
|
||||
PI->splitEdge(TIBB, DestBB, NewBB, MergeIdenticalEdges);
|
||||
|
||||
return NewBB;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user