summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2014-01-29 04:36:12 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2014-01-29 04:36:12 +0000
commit1aab75ab49597a97dbecd1a34fc9db1b9f75932c (patch)
tree6e23a4012fa8cc1df49d585985ea6161ae4b00b3 /llvm/lib/Transforms
parent7a578026ae60a345e7f614c81285b1fe7d497f10 (diff)
downloadbcm5719-llvm-1aab75ab49597a97dbecd1a34fc9db1b9f75932c.tar.gz
bcm5719-llvm-1aab75ab49597a97dbecd1a34fc9db1b9f75932c.zip
LoopVectorizer: Don't count the induction variable multiple times
When estimating register pressure, don't count the induction variable mulitple times. It is unlikely to be unrolled. This is currently disabled and hidden behind a flag ("enable-ind-var-reg-heur"). llvm-svn: 200371
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c72c2dc41fc..1ffb4289cbd 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -188,6 +188,10 @@ static cl::opt<unsigned> NumberOfStoresToPredicate(
"vectorize-num-stores-pred", cl::init(0), cl::Hidden,
cl::desc("Max number of stores to be predicated behind an if."));
+static cl::opt<bool> EnableIndVarRegisterHeur(
+ "enable-ind-var-reg-heur", cl::init(false), cl::Hidden,
+ cl::desc("Count the induction variable only once when unrolling"));
+
static cl::opt<bool> EnableCondStoresVectorization(
"enable-cond-stores-vec", cl::init(false), cl::Hidden,
cl::desc("Enable if predication of stores during vectorization."));
@@ -5155,6 +5159,11 @@ LoopVectorizationCostModel::selectUnrollFactor(bool OptForSize,
unsigned UF = PowerOf2Floor((TargetNumRegisters - R.LoopInvariantRegs) /
R.MaxLocalUsers);
+ // Don't count the induction variable as unrolled.
+ if (EnableIndVarRegisterHeur)
+ UF = PowerOf2Floor((TargetNumRegisters - R.LoopInvariantRegs - 1) /
+ std::max(1U, (R.MaxLocalUsers - 1)));
+
// Clamp the unroll factor ranges to reasonable factors.
unsigned MaxUnrollSize = TTI.getMaximumUnrollFactor();
OpenPOWER on IntegriCloud