mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Throttle tail merging; handling blocks with large numbers of predecessors
is too slow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -564,6 +564,9 @@ bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
|
|||||||
return MadeChange;
|
return MadeChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Throttle for huge numbers of predecessors (compile speed problems)
|
||||||
|
#define THRESHOLD 100
|
||||||
|
|
||||||
bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
|
bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
|
||||||
|
|
||||||
if (!EnableTailMerge) return false;
|
if (!EnableTailMerge) return false;
|
||||||
@ -577,6 +580,7 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
|
|||||||
MergePotentials.push_back(std::make_pair(HashEndOfMBB(I, 2U), I));
|
MergePotentials.push_back(std::make_pair(HashEndOfMBB(I, 2U), I));
|
||||||
}
|
}
|
||||||
// See if we can do any tail merging on those.
|
// See if we can do any tail merging on those.
|
||||||
|
if (MergePotentials.size() < THRESHOLD)
|
||||||
MadeChange |= TryMergeBlocks(NULL, NULL);
|
MadeChange |= TryMergeBlocks(NULL, NULL);
|
||||||
|
|
||||||
// Look at blocks (IBB) with multiple predecessors (PBB).
|
// Look at blocks (IBB) with multiple predecessors (PBB).
|
||||||
@ -599,7 +603,7 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
|
|||||||
// transformations.)
|
// transformations.)
|
||||||
|
|
||||||
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
|
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
|
||||||
if (!I->succ_empty() && I->pred_size() >= 2) {
|
if (!I->succ_empty() && I->pred_size() >= 2 && I->pred_size() < THRESHOLD) {
|
||||||
MachineBasicBlock *IBB = I;
|
MachineBasicBlock *IBB = I;
|
||||||
MachineBasicBlock *PredBB = prior(I);
|
MachineBasicBlock *PredBB = prior(I);
|
||||||
MergePotentials.clear();
|
MergePotentials.clear();
|
||||||
|
Reference in New Issue
Block a user