[LAA-memchecks 1/3] Split out NumComparisons checks. NFC

The check for the number of memchecks will be moved to the client of
this analysis.  Besides allowing for transform-specific thresholds, this
also lets Loop Distribution post-process the memchecks; Loop
Distribution only needs memchecks between pointers of different
partitions.

The motivation for this first patch is to untangle the CanDoRT check
from the NumComparison check before moving the NumComparison part.
CanDoRT means that we couldn't determine the bounds for the pointer.
Note that NumComparison is set independent of this flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2015-03-10 18:54:19 +00:00
parent 9677d4f3f3
commit 17c9aca856

View File

@ -1086,18 +1086,10 @@ void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
if (NumComparisons == 0 && NeedRTCheck) if (NumComparisons == 0 && NeedRTCheck)
NeedRTCheck = false; NeedRTCheck = false;
// Check that we did not collect too many pointers or found an unsizeable // Check that we did not find an unsizeable pointer.
// pointer. if (CanDoRT)
if (!CanDoRT || NumComparisons > RuntimeMemoryCheckThreshold) {
PtrRtCheck.reset();
CanDoRT = false;
}
if (CanDoRT) {
DEBUG(dbgs() << "LAA: We can perform a memory runtime check if needed.\n"); DEBUG(dbgs() << "LAA: We can perform a memory runtime check if needed.\n");
} else if (NeedRTCheck) {
if (NeedRTCheck && !CanDoRT) {
emitAnalysis(LoopAccessReport() << "cannot identify array bounds"); emitAnalysis(LoopAccessReport() << "cannot identify array bounds");
DEBUG(dbgs() << "LAA: We can't vectorize because we can't find " << DEBUG(dbgs() << "LAA: We can't vectorize because we can't find " <<
"the array bounds.\n"); "the array bounds.\n");
@ -1106,6 +1098,17 @@ void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
return; return;
} }
if (NumComparisons > RuntimeMemoryCheckThreshold) {
emitAnalysis(LoopAccessReport()
<< NumComparisons << " exceeds limit of "
<< RuntimeMemoryCheckThreshold
<< " dependent memory operations checked at runtime");
DEBUG(dbgs() << "LAA: Too many memory checks needed.\n");
PtrRtCheck.reset();
CanVecMem = false;
return;
}
PtrRtCheck.Need = NeedRTCheck; PtrRtCheck.Need = NeedRTCheck;
CanVecMem = true; CanVecMem = true;
@ -1127,13 +1130,18 @@ void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
CanDoRT = Accesses.canCheckPtrAtRT(PtrRtCheck, NumComparisons, SE, CanDoRT = Accesses.canCheckPtrAtRT(PtrRtCheck, NumComparisons, SE,
TheLoop, Strides, true); TheLoop, Strides, true);
// Check that we did not collect too many pointers or found an unsizeable // Check that we didn't find an unsizeable pointer.
// pointer. if (!CanDoRT && NumComparisons > 0) {
if (!CanDoRT || NumComparisons > RuntimeMemoryCheckThreshold) {
if (!CanDoRT && NumComparisons > 0)
emitAnalysis(LoopAccessReport() emitAnalysis(LoopAccessReport()
<< "cannot check memory dependencies at runtime"); << "cannot check memory dependencies at runtime");
else DEBUG(dbgs() << "LAA: Can't vectorize with memory checks\n");
PtrRtCheck.reset();
CanVecMem = false;
return;
}
// Check that we did not collect too many pointers.
if (NumComparisons > RuntimeMemoryCheckThreshold) {
emitAnalysis(LoopAccessReport() emitAnalysis(LoopAccessReport()
<< NumComparisons << " exceeds limit of " << NumComparisons << " exceeds limit of "
<< RuntimeMemoryCheckThreshold << RuntimeMemoryCheckThreshold