diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-01-29 04:36:12 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-01-29 04:36:12 +0000 |
commit | 8dc253e97b1a119acb9a8f3c2f8305871a3906e1 (patch) | |
tree | e8e9696b7ec700f2a28f5cd919bc931a889272e0 | |
parent | c86f56a506b121c956101888c46c060258986fb5 (diff) | |
download | llvm-8dc253e97b1a119acb9a8f3c2f8305871a3906e1.tar.gz llvm-8dc253e97b1a119acb9a8f3c2f8305871a3906e1.tar.bz2 llvm-8dc253e97b1a119acb9a8f3c2f8305871a3906e1.tar.xz |
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").
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200371 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index c72c2dc41f..1ffb4289cb 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/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(); |