mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 06:30:39 +00:00
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
This commit is contained in:
parent
f57a43da9c
commit
3c85eef81a
@ -28,11 +28,15 @@
|
|||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/ValueHolder.h"
|
#include "llvm/Support/ValueHolder.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
|
#include "Support/CommandLine.h"
|
||||||
#include "Support/Debug.h"
|
#include "Support/Debug.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
cl::opt<unsigned>
|
||||||
|
Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
|
||||||
|
cl::init(6), cl::Hidden);
|
||||||
Statistic<> NumEliminated("tailduplicate",
|
Statistic<> NumEliminated("tailduplicate",
|
||||||
"Number of unconditional branches eliminated");
|
"Number of unconditional branches eliminated");
|
||||||
Statistic<> NumPHINodes("tailduplicate", "Number of phi nodes inserted");
|
Statistic<> NumPHINodes("tailduplicate", "Number of phi nodes inserted");
|
||||||
@ -106,7 +110,7 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
|
|||||||
while (isa<PHINode>(*I)) ++I;
|
while (isa<PHINode>(*I)) ++I;
|
||||||
|
|
||||||
for (unsigned Size = 0; I != Dest->end(); ++Size, ++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
|
// 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
|
// with a single successor if the block has many other predecessors. This can
|
||||||
|
Loading…
Reference in New Issue
Block a user