mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-07 12:07:17 +00:00
Defer adding critical edges to the "toSplit" list until after checking for
indirect branches in all the predecessors. This avoids unnecessarily splitting edges in cases where load PRE is not possible anyway. Thanks to Jakub Staszak for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd465012b3
commit
34414a634e
@ -1584,7 +1584,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
|
||||
for (unsigned i = 0, e = UnavailableBlocks.size(); i != e; ++i)
|
||||
FullyAvailableBlocks[UnavailableBlocks[i]] = false;
|
||||
|
||||
bool NeedToSplitEdges = false;
|
||||
SmallVector<std::pair<TerminatorInst*, unsigned>, 4> NeedToSplit;
|
||||
for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB);
|
||||
PI != E; ++PI) {
|
||||
BasicBlock *Pred = *PI;
|
||||
@ -1600,12 +1600,13 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
|
||||
return false;
|
||||
}
|
||||
unsigned SuccNum = GetSuccessorNumber(Pred, LoadBB);
|
||||
toSplit.push_back(std::make_pair(Pred->getTerminator(), SuccNum));
|
||||
NeedToSplitEdges = true;
|
||||
NeedToSplit.push_back(std::make_pair(Pred->getTerminator(), SuccNum));
|
||||
}
|
||||
}
|
||||
if (NeedToSplitEdges)
|
||||
if (!NeedToSplit.empty()) {
|
||||
toSplit.append(NeedToSplit.size(), NeedToSplit.front());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decide whether PRE is profitable for this load.
|
||||
unsigned NumUnavailablePreds = PredLoads.size();
|
||||
|
Loading…
Reference in New Issue
Block a user