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

llvm-svn: 13025
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
index 40821e4..b687084 100644
--- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
@@ -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