summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-11-25 16:48:08 +0000
committerNadav Rotem <nrotem@apple.com>2012-11-25 16:48:08 +0000
commit6bfc3481bd8995906af4c15131feeae665a197c6 (patch)
tree9acb39c5d3fd294b5ffcda6f05a66020b27773f3 /lib/Transforms
parent00e8074ee24449e5d0e50b626290b499b8bd78b1 (diff)
downloadllvm-6bfc3481bd8995906af4c15131feeae665a197c6.tar.gz
llvm-6bfc3481bd8995906af4c15131feeae665a197c6.tar.bz2
llvm-6bfc3481bd8995906af4c15131feeae665a197c6.tar.xz
Move the max vector width to a constant parameter. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9cba136c72..e79d526aad 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -86,6 +86,9 @@ const unsigned TinyTripCountThreshold = 16;
/// number of pointers. Notice that the check is quadratic!
const unsigned RuntimeMemoryCheckThreshold = 2;
+/// This is the highest vector width that we try to generate.
+const unsigned MaxVectorSize = 8;
+
namespace {
// Forward declarations.
@@ -130,7 +133,7 @@ public:
private:
/// Add code that checks at runtime if the accessed arrays overlap.
/// Returns the comperator value or NULL if no check is needed.
- Value* addRuntimeCheck(LoopVectorizationLegality *Legal,
+ Value* addRuntimeCheck(LoopVectorizationLegality *Legal,
Instruction *Loc);
/// Create an empty loop, based on the loop ranges of the old loop.
void createEmptyLoop(LoopVectorizationLegality *Legal);
@@ -400,7 +403,7 @@ public:
/// Returns the most profitable vectorization factor for the loop that is
/// smaller or equal to the VF argument. This method checks every power
/// of two up to VF.
- unsigned findBestVectorizationFactor(unsigned VF = 8);
+ unsigned findBestVectorizationFactor(unsigned VF = MaxVectorSize);
private:
/// Returns the expected execution cost. The unit of the cost does
@@ -856,13 +859,12 @@ SingleBlockLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) {
StartIdx,
"cmp.zero", Loc);
- Value *MemoryRuntimeCheck = addRuntimeCheck(Legal, Loc);
+ Value *MemoryRuntimeCheck = addRuntimeCheck(Legal, Loc);
// If we are using memory runtime checks, include them in.
- if (MemoryRuntimeCheck) {
+ if (MemoryRuntimeCheck)
Cmp = BinaryOperator::Create(Instruction::Or, Cmp, MemoryRuntimeCheck,
"CntOrMem", Loc);
- }
BranchInst::Create(MiddleBlock, VectorPH, Cmp, Loc);
// Remove the old terminator.