[llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Apr 17 19:53:00 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

TailDuplication.cpp updated: 1.18 -> 1.19

---
Log message:

Make the tail duplication threshold accessible from the command line instead of hardcoded


---
Diffs of the changes:  (+5 -1)

Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.18 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.19
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.18	Tue Mar 16 17:36:49 2004
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp	Sat Apr 17 19:52:43 2004
@@ -28,11 +28,15 @@
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/ValueHolder.h"
 #include "llvm/Transforms/Utils/Local.h"
+#include "Support/CommandLine.h"
 #include "Support/Debug.h"
 #include "Support/Statistic.h"
 using namespace llvm;
 
 namespace {
+  cl::opt<unsigned>
+  Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
+            cl::init(6), cl::Hidden);
   Statistic<> NumEliminated("tailduplicate",
                             "Number of unconditional branches eliminated");
   Statistic<> NumPHINodes("tailduplicate", "Number of phi nodes inserted");
@@ -106,7 +110,7 @@
   while (isa<PHINode>(*I)) ++I;
 
   for (unsigned Size = 0; I != Dest->end(); ++Size, ++I)
-    if (Size == 6) return false;  // The block is too large...
+    if (Size == Threshold) return false;  // The block is too large...
 
   // Do not tail duplicate a block that has thousands of successors into a block
   // with a single successor if the block has many other predecessors.  This can





More information about the llvm-commits mailing list