[LoopAccesses] Add command-line option for RuntimeMemoryCheckThreshold

Also remove the somewhat misleading initializers from
VectorizationFactor and VectorizationInterleave.  They will get
initialized with the default ctor since no cl::init is provided.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230608 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2015-02-26 04:39:09 +00:00
parent 9868473dff
commit 5a51d864b9
2 changed files with 12 additions and 11 deletions

View File

@ -83,7 +83,7 @@ struct VectorizerParams {
/// \\brief When performing memory disambiguation checks at runtime do not /// \\brief When performing memory disambiguation checks at runtime do not
/// make more than this number of comparisons. /// make more than this number of comparisons.
static const unsigned RuntimeMemoryCheckThreshold; static unsigned RuntimeMemoryCheckThreshold;
}; };
/// \brief Drive the analysis of memory accesses in the loop /// \brief Drive the analysis of memory accesses in the loop

View File

@ -29,7 +29,7 @@ static cl::opt<unsigned, true>
VectorizationFactor("force-vector-width", cl::Hidden, VectorizationFactor("force-vector-width", cl::Hidden,
cl::desc("Sets the SIMD width. Zero is autoselect."), cl::desc("Sets the SIMD width. Zero is autoselect."),
cl::location(VectorizerParams::VectorizationFactor)); cl::location(VectorizerParams::VectorizationFactor));
unsigned VectorizerParams::VectorizationFactor = 0; unsigned VectorizerParams::VectorizationFactor;
static cl::opt<unsigned, true> static cl::opt<unsigned, true>
VectorizationInterleave("force-vector-interleave", cl::Hidden, VectorizationInterleave("force-vector-interleave", cl::Hidden,
@ -37,11 +37,14 @@ VectorizationInterleave("force-vector-interleave", cl::Hidden,
"Zero is autoselect."), "Zero is autoselect."),
cl::location( cl::location(
VectorizerParams::VectorizationInterleave)); VectorizerParams::VectorizationInterleave));
unsigned VectorizerParams::VectorizationInterleave = 0; unsigned VectorizerParams::VectorizationInterleave;
/// When performing memory disambiguation checks at runtime do not make more static cl::opt<unsigned, true> RuntimeMemoryCheckThreshold(
/// than this number of comparisons. "runtime-memory-check-threshold", cl::Hidden,
const unsigned VectorizerParams::RuntimeMemoryCheckThreshold = 8; cl::desc("When performing memory disambiguation checks at runtime do not "
"generate more than this number of comparisons (default = 8)."),
cl::location(VectorizerParams::RuntimeMemoryCheckThreshold), cl::init(8));
unsigned VectorizerParams::RuntimeMemoryCheckThreshold;
/// Maximum SIMD width. /// Maximum SIMD width.
const unsigned VectorizerParams::MaxVectorWidth = 64; const unsigned VectorizerParams::MaxVectorWidth = 64;
@ -1112,8 +1115,7 @@ void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
// Check that we did not collect too many pointers or found an unsizeable // Check that we did not collect too many pointers or found an unsizeable
// pointer. // pointer.
if (!CanDoRT || if (!CanDoRT || NumComparisons > RuntimeMemoryCheckThreshold) {
NumComparisons > VectorizerParams::RuntimeMemoryCheckThreshold) {
PtrRtCheck.reset(); PtrRtCheck.reset();
CanDoRT = false; CanDoRT = false;
} }
@ -1154,15 +1156,14 @@ void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
TheLoop, Strides, true); TheLoop, Strides, true);
// Check that we did not collect too many pointers or found an unsizeable // Check that we did not collect too many pointers or found an unsizeable
// pointer. // pointer.
if (!CanDoRT || if (!CanDoRT || NumComparisons > RuntimeMemoryCheckThreshold) {
NumComparisons > VectorizerParams::RuntimeMemoryCheckThreshold) {
if (!CanDoRT && NumComparisons > 0) if (!CanDoRT && NumComparisons > 0)
emitAnalysis(LoopAccessReport() emitAnalysis(LoopAccessReport()
<< "cannot check memory dependencies at runtime"); << "cannot check memory dependencies at runtime");
else else
emitAnalysis(LoopAccessReport() emitAnalysis(LoopAccessReport()
<< NumComparisons << " exceeds limit of " << NumComparisons << " exceeds limit of "
<< VectorizerParams::RuntimeMemoryCheckThreshold << RuntimeMemoryCheckThreshold
<< " dependent memory operations checked at runtime"); << " dependent memory operations checked at runtime");
DEBUG(dbgs() << "LAA: Can't vectorize with memory checks\n"); DEBUG(dbgs() << "LAA: Can't vectorize with memory checks\n");
PtrRtCheck.reset(); PtrRtCheck.reset();