summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2015-02-18 03:42:43 +0000
committerAdam Nemet <anemet@apple.com>2015-02-18 03:42:43 +0000
commit4f3ede5a01041aab7cd4d185bdf2cfd2d653a1d2 (patch)
tree4322c43fb365030b1f5052c27a9fa4f64c95c03a /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parent30f16e1696235b985b2c440d7fa0d3b8298be713 (diff)
downloadbcm5719-llvm-4f3ede5a01041aab7cd4d185bdf2cfd2d653a1d2.tar.gz
bcm5719-llvm-4f3ede5a01041aab7cd4d185bdf2cfd2d653a1d2.zip
[LoopAccesses] Make VectorizerParams global
As LAA is becoming a pass, we can no longer pass the params to its constructor. This changes the command line flags to have external storage. These can now be accessed both from LV and LAA. VectorizerParams is moved out of LoopAccessInfo in order to shorten the code to access it. This is part of the patchset that converts LoopAccessAnalysis into an actual analysis pass. llvm-svn: 229622
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index bd39b8048b1..3f6660203c0 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -106,14 +106,19 @@ using namespace llvm::PatternMatch;
STATISTIC(LoopsVectorized, "Number of loops vectorized");
STATISTIC(LoopsAnalyzed, "Number of loops analyzed for vectorization");
-static cl::opt<unsigned>
-VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden,
- cl::desc("Sets the SIMD width. Zero is autoselect."));
-
-static cl::opt<unsigned>
-VectorizationInterleave("force-vector-interleave", cl::init(0), cl::Hidden,
- cl::desc("Sets the vectorization interleave count. "
- "Zero is autoselect."));
+static cl::opt<unsigned, true>
+VectorizationFactor("force-vector-width", cl::Hidden,
+ cl::desc("Sets the SIMD width. Zero is autoselect."),
+ cl::location(VectorizerParams::VectorizationFactor));
+unsigned VectorizerParams::VectorizationFactor = 0;
+
+static cl::opt<unsigned, true>
+VectorizationInterleave("force-vector-interleave", cl::Hidden,
+ cl::desc("Sets the vectorization interleave count. "
+ "Zero is autoselect."),
+ cl::location(
+ VectorizerParams::VectorizationInterleave));
+unsigned VectorizerParams::VectorizationInterleave = 0;
static cl::opt<bool>
EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden,
@@ -147,10 +152,10 @@ static const unsigned TinyTripCountUnrollThreshold = 128;
/// When performing memory disambiguation checks at runtime do not make more
/// than this number of comparisons.
-static const unsigned RuntimeMemoryCheckThreshold = 8;
+const unsigned VectorizerParams::RuntimeMemoryCheckThreshold = 8;
/// Maximum simd width.
-static const unsigned MaxVectorWidth = 64;
+const unsigned VectorizerParams::MaxVectorWidth = 64;
static cl::opt<unsigned> ForceTargetNumScalarRegs(
"force-target-num-scalar-regs", cl::init(0), cl::Hidden,
@@ -551,10 +556,7 @@ public:
: NumPredStores(0), TheLoop(L), SE(SE), DL(DL),
TLI(TLI), TheFunction(F), TTI(TTI), Induction(nullptr),
WidestIndTy(nullptr),
- LAI(F, L, SE, DL, TLI, AA, DT,
- LoopAccessInfo::VectorizerParams(
- MaxVectorWidth, VectorizationFactor, VectorizationInterleave,
- RuntimeMemoryCheckThreshold)),
+ LAI(F, L, SE, DL, TLI, AA, DT),
HasFunNoNaNAttr(false) {}
/// This enum represents the kinds of reductions that we support.
@@ -1019,7 +1021,7 @@ class LoopVectorizeHints {
bool validate(unsigned Val) {
switch (Kind) {
case HK_WIDTH:
- return isPowerOf2_32(Val) && Val <= MaxVectorWidth;
+ return isPowerOf2_32(Val) && Val <= VectorizerParams::MaxVectorWidth;
case HK_UNROLL:
return isPowerOf2_32(Val) && Val <= MaxInterleaveFactor;
case HK_FORCE:
OpenPOWER on IntegriCloud