[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp

Dale Johannesen dalej at apple.com
Thu Jun 7 18:09:13 PDT 2007



Changes in directory llvm/lib/CodeGen:

BranchFolding.cpp updated: 1.66 -> 1.67
---
Log message:

Make throttle a hidden parameter, per review.


---
Diffs of the changes:  (+11 -6)

 BranchFolding.cpp |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.66 llvm/lib/CodeGen/BranchFolding.cpp:1.67
--- llvm/lib/CodeGen/BranchFolding.cpp:1.66	Thu Jun  7 19:34:27 2007
+++ llvm/lib/CodeGen/BranchFolding.cpp	Thu Jun  7 20:08:52 2007
@@ -38,6 +38,12 @@
 static cl::opt<cl::boolOrDefault> FlagEnableTailMerge("enable-tail-merge", 
                               cl::init(cl::BOU_UNSET), cl::Hidden);
 namespace {
+  // Throttle for huge numbers of predecessors (compile speed problems)
+  cl::opt<unsigned>
+  TailMergeThreshold("tail-merge-threshold", 
+            cl::desc("Max number of predecessors to consider tail merging"),
+            cl::init(100), cl::Hidden);
+
   struct BranchFolder : public MachineFunctionPass {
     static char ID;
     BranchFolder(bool defaultEnableTailMerge) : 
@@ -564,9 +570,6 @@
   return MadeChange;
 }
 
-// Throttle for huge numbers of predecessors (compile speed problems)
-#define THRESHOLD 100
-
 bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
 
   if (!EnableTailMerge) return false;
@@ -580,7 +583,7 @@
       MergePotentials.push_back(std::make_pair(HashEndOfMBB(I, 2U), I));
   }
   // See if we can do any tail merging on those.
-  if (MergePotentials.size() < THRESHOLD)
+  if (MergePotentials.size() < TailMergeThreshold)
     MadeChange |= TryMergeBlocks(NULL, NULL);
 
   // Look at blocks (IBB) with multiple predecessors (PBB).
@@ -603,11 +606,13 @@
   // transformations.)
 
   for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
-    if (!I->succ_empty() && I->pred_size() >= 2 && I->pred_size() < THRESHOLD) {
+    if (!I->succ_empty() && I->pred_size() >= 2 && 
+         I->pred_size() < TailMergeThreshold) {
       MachineBasicBlock *IBB = I;
       MachineBasicBlock *PredBB = prior(I);
       MergePotentials.clear();
-      for (MachineBasicBlock::pred_iterator P = I->pred_begin(), E2 = I->pred_end(); 
+      for (MachineBasicBlock::pred_iterator P = I->pred_begin(), 
+                                            E2 = I->pred_end();
            P != E2; ++P) {
         MachineBasicBlock* PBB = *P;
         // Skip blocks that loop to themselves, can't tail merge these.






More information about the llvm-commits mailing list