aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/TailDuplication.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-18 00:52:43 +0000
committerChris Lattner <sabre@nondot.org>2004-04-18 00:52:43 +0000
commit3c85eef81a13d6a2943562e5953a73a6ef6684c0 (patch)
treecd617e7fcc030453fef3be249e689b490ce07e77 /lib/Transforms/Scalar/TailDuplication.cpp
parentf57a43da9c0198b8958df464755b556c83a65dd0 (diff)
downloadexternal_llvm-3c85eef81a13d6a2943562e5953a73a6ef6684c0.zip
external_llvm-3c85eef81a13d6a2943562e5953a73a6ef6684c0.tar.gz
external_llvm-3c85eef81a13d6a2943562e5953a73a6ef6684c0.tar.bz2
Make the tail duplication threshold accessible from the command line instead of hardcoded
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/TailDuplication.cpp')
-rw-r--r--lib/Transforms/Scalar/TailDuplication.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp
index 40821e4..b687084 100644
--- a/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/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 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
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