Index: include/llvm/Analysis/LoopAccessAnalysis.h =================================================================== --- include/llvm/Analysis/LoopAccessAnalysis.h +++ include/llvm/Analysis/LoopAccessAnalysis.h @@ -78,6 +78,8 @@ static unsigned VectorizationFactor; /// \brief Interleave factor as overridden by the user. static unsigned VectorizationInterleave; + /// \brief True if force-vector-interleave was specified by the user. + static bool isInterleaveForced(); /// \\brief When performing memory disambiguation checks at runtime do not /// make more than this number of comparisons. Index: lib/Analysis/LoopAccessAnalysis.cpp =================================================================== --- lib/Analysis/LoopAccessAnalysis.cpp +++ lib/Analysis/LoopAccessAnalysis.cpp @@ -25,6 +25,31 @@ #define DEBUG_TYPE "loop-accesses" +static cl::opt +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 +VectorizationInterleave("force-vector-interleave", cl::Hidden, + cl::desc("Sets the vectorization interleave count. " + "Zero is autoselect."), + cl::location( + VectorizerParams::VectorizationInterleave)); +unsigned VectorizerParams::VectorizationInterleave = 0; + +/// When performing memory disambiguation checks at runtime do not make more +/// than this number of comparisons. +const unsigned VectorizerParams::RuntimeMemoryCheckThreshold = 8; + +/// Maximum SIMD width. +const unsigned VectorizerParams::MaxVectorWidth = 64; + +bool VectorizerParams::isInterleaveForced() { + return ::VectorizationInterleave.getNumOccurrences() > 0; +} + void LoopAccessReport::emitAnalysis(const LoopAccessReport &Message, const Function *TheFunction, const Loop *TheLoop, Index: lib/Transforms/Vectorize/LoopVectorize.cpp =================================================================== --- lib/Transforms/Vectorize/LoopVectorize.cpp +++ lib/Transforms/Vectorize/LoopVectorize.cpp @@ -106,20 +106,6 @@ STATISTIC(LoopsVectorized, "Number of loops vectorized"); STATISTIC(LoopsAnalyzed, "Number of loops analyzed for vectorization"); -static cl::opt -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 -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 EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden, cl::desc("Enable if-conversion during vectorization.")); @@ -150,13 +136,6 @@ /// We don't unroll loops with a known constant trip count below this number. static const unsigned TinyTripCountUnrollThreshold = 128; -/// When performing memory disambiguation checks at runtime do not make more -/// than this number of comparisons. -const unsigned VectorizerParams::RuntimeMemoryCheckThreshold = 8; - -/// Maximum simd width. -const unsigned VectorizerParams::MaxVectorWidth = 64; - static cl::opt ForceTargetNumScalarRegs( "force-target-num-scalar-regs", cl::init(0), cl::Hidden, cl::desc("A flag that overrides the target's number of scalar registers.")); @@ -1074,7 +1053,8 @@ }; LoopVectorizeHints(const Loop *L, bool DisableInterleaving) - : Width("vectorize.width", VectorizationFactor, HK_WIDTH), + : Width("vectorize.width", VectorizerParams::VectorizationFactor, + HK_WIDTH), Interleave("interleave.count", DisableInterleaving, HK_UNROLL), Force("vectorize.enable", FK_Undefined, HK_FORCE), TheLoop(L) { @@ -1082,8 +1062,8 @@ getHintsFromMetadata(); // force-vector-interleave overrides DisableInterleaving. - if (VectorizationInterleave.getNumOccurrences() > 0) - Interleave.Value = VectorizationInterleave; + if (VectorizerParams::isInterleaveForced()) + Interleave.Value = VectorizerParams::VectorizationInterleave; DEBUG(if (DisableInterleaving && Interleave.Value == 1) dbgs() << "LV: Interleaving disabled by the pass manager\n");