mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
[LoopAccesses] Make VectorizerParams global + fix for cyclic dep
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 commits also has the fix (D7731) to the break dependence cycle between the analysis and vector libraries. This is part of the patchset that converts LoopAccessAnalysis into an actual analysis pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229890 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -106,15 +106,6 @@ 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<bool>
|
||||
EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden,
|
||||
cl::desc("Enable if-conversion during vectorization."));
|
||||
@ -145,13 +136,6 @@ static cl::opt<bool> EnableMemAccessVersioning(
|
||||
/// 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.
|
||||
static const unsigned RuntimeMemoryCheckThreshold = 8;
|
||||
|
||||
/// Maximum simd width.
|
||||
static const unsigned MaxVectorWidth = 64;
|
||||
|
||||
static cl::opt<unsigned> ForceTargetNumScalarRegs(
|
||||
"force-target-num-scalar-regs", cl::init(0), cl::Hidden,
|
||||
cl::desc("A flag that overrides the target's number of scalar registers."));
|
||||
@ -551,10 +535,7 @@ public:
|
||||
: NumPredStores(0), TheLoop(L), SE(SE), DL(DL),
|
||||
TLI(TLI), TheFunction(F), TTI(TTI), DT(DT), 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.
|
||||
@ -1021,7 +1002,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:
|
||||
@ -1049,7 +1030,8 @@ public:
|
||||
};
|
||||
|
||||
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) {
|
||||
@ -1057,8 +1039,8 @@ public:
|
||||
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");
|
||||
|
Reference in New Issue
Block a user