summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-06-08 00:34:27 +0000
committerDale Johannesen <dalej@apple.com>2007-06-08 00:34:27 +0000
commit52fcf022f71477f6b8a0bc1fffd34c758ddd797d (patch)
tree874b00bccabbf9323f77f0e8025c829e0dbf8909 /llvm/lib/CodeGen/BranchFolding.cpp
parentbc3b9a1c8af0c13797cb561a852b10b5f9fa1246 (diff)
downloadbcm5719-llvm-52fcf022f71477f6b8a0bc1fffd34c758ddd797d.tar.gz
bcm5719-llvm-52fcf022f71477f6b8a0bc1fffd34c758ddd797d.zip
Throttle tail merging; handling blocks with large numbers of predecessors
is too slow. llvm-svn: 37509
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index ffde173e695..1125511a846 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -564,6 +564,9 @@ bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
return MadeChange;
}
+// Throttle for huge numbers of predecessors (compile speed problems)
+#define THRESHOLD 100
+
bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
if (!EnableTailMerge) return false;
@@ -577,7 +580,8 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
MergePotentials.push_back(std::make_pair(HashEndOfMBB(I, 2U), I));
}
// See if we can do any tail merging on those.
- MadeChange |= TryMergeBlocks(NULL, NULL);
+ if (MergePotentials.size() < THRESHOLD)
+ MadeChange |= TryMergeBlocks(NULL, NULL);
// Look at blocks (IBB) with multiple predecessors (PBB).
// We change each predecessor to a canonical form, by
@@ -599,7 +603,7 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
// transformations.)
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 *PredBB = prior(I);
MergePotentials.clear();
OpenPOWER on IntegriCloud