[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet
2015-02-18 03:42:43 +00:00
parent 38a9ebb065
commit eefec589e8
3 changed files with 50 additions and 61 deletions

View File

@@ -60,6 +60,22 @@ public:
const Loop *TheLoop);
};
/// \brief Collection of parameters shared beetween the Loop Vectorizer and the
/// Loop Access Analysis.
struct VectorizerParams {
/// \brief Maximum SIMD width.
static const unsigned MaxVectorWidth;
/// \brief VF as overridden by the user.
static unsigned VectorizationFactor;
/// \brief Interleave factor as overridden by the user.
static unsigned VectorizationInterleave;
/// \\brief When performing memory disambiguation checks at runtime do not
/// make more than this number of comparisons.
static const unsigned RuntimeMemoryCheckThreshold;
};
/// \brief Drive the analysis of memory accesses in the loop
///
/// This class is responsible for analyzing the memory accesses of a loop. It
@@ -76,30 +92,6 @@ public:
/// RuntimePointerCheck class.
class LoopAccessInfo {
public:
/// \brief Collection of parameters used from the vectorizer.
struct VectorizerParams {
/// \brief Maximum simd width.
unsigned MaxVectorWidth;
/// \brief VF as overridden by the user.
unsigned VectorizationFactor;
/// \brief Interleave factor as overridden by the user.
unsigned VectorizationInterleave;
/// \\brief When performing memory disambiguation checks at runtime do not
/// make more than this number of comparisons.
unsigned RuntimeMemoryCheckThreshold;
VectorizerParams(unsigned MaxVectorWidth,
unsigned VectorizationFactor,
unsigned VectorizationInterleave,
unsigned RuntimeMemoryCheckThreshold) :
MaxVectorWidth(MaxVectorWidth),
VectorizationFactor(VectorizationFactor),
VectorizationInterleave(VectorizationInterleave),
RuntimeMemoryCheckThreshold(RuntimeMemoryCheckThreshold) {}
};
/// This struct holds information about the memory runtime legality check that
/// a group of pointers do not overlap.
struct RuntimePointerCheck {
@@ -139,11 +131,9 @@ public:
LoopAccessInfo(Function *F, Loop *L, ScalarEvolution *SE,
const DataLayout *DL, const TargetLibraryInfo *TLI,
AliasAnalysis *AA, DominatorTree *DT,
const VectorizerParams &VectParams) :
AliasAnalysis *AA, DominatorTree *DT) :
TheFunction(F), TheLoop(L), SE(SE), DL(DL), TLI(TLI), AA(AA), DT(DT),
NumLoads(0), NumStores(0), MaxSafeDepDistBytes(-1U),
VectParams(VectParams) {}
NumLoads(0), NumStores(0), MaxSafeDepDistBytes(-1U) {}
/// Return true we can analyze the memory accesses in the loop and there are
/// no memory dependence cycles. Replaces symbolic strides using Strides.
@@ -187,9 +177,6 @@ private:
unsigned NumStores;
unsigned MaxSafeDepDistBytes;
/// \brief Vectorizer parameters used by the analysis.
VectorizerParams VectParams;
};
Value *stripIntegerCast(Value *V);