1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Revert "[LAA] We only need pointer checks if there are non-zero checks (NFC)."

This reverts commit 259abfc7cbc11cd98c05b1eb8e4b3fb6a9664bc0.

Reverting this, as I missed a case where we return without setting
RtCheck.Need.
This commit is contained in:
Florian Hahn 2020-05-27 12:39:45 +01:00
parent ff54e7f7fe
commit 4da66aadc3
2 changed files with 12 additions and 18 deletions

View File

@ -701,14 +701,12 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
ScalarEvolution *SE, Loop *TheLoop,
const ValueToValueMap &StridesMap,
bool ShouldCheckWrap) {
if (!IsRTCheckAnalysisNeeded)
return true;
// Find pointers with computable bounds. We are going to use this information
// to place a runtime bound check.
bool CanDoRT = true;
RtCheck.Need = false;
bool NeedRTCheck = false;
if (!IsRTCheckAnalysisNeeded) return true;
bool IsDepCheckNeeded = isDependencyCheckNeeded();
@ -749,10 +747,10 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
// check them. But there is no need to checks if there is only one
// dependence set for this alias set.
//
// Note that this function computes CanDoRT and RtCheck.Need independently.
// For example CanDoRT=false, RtCheck.Need=false means that we have a
// pointer for which we couldn't find the bounds but we don't actually need
// to emit any checks so it does not matter.
// Note that this function computes CanDoRT and NeedRTCheck independently.
// For example CanDoRT=false, NeedRTCheck=false means that we have a pointer
// for which we couldn't find the bounds but we don't actually need to emit
// any checks so it does not matter.
bool NeedsAliasSetRTCheck = false;
if (!(IsDepCheckNeeded && CanDoAliasSetRT && RunningDepId == 2))
NeedsAliasSetRTCheck = (NumWritePtrChecks >= 2 ||
@ -775,7 +773,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
}
CanDoRT &= CanDoAliasSetRT;
RtCheck.Need |= NeedsAliasSetRTCheck;
NeedRTCheck |= NeedsAliasSetRTCheck;
++ASId;
}
@ -809,19 +807,15 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
}
}
if (RtCheck.Need && CanDoRT)
if (NeedRTCheck && CanDoRT)
RtCheck.generateChecks(DepCands, IsDepCheckNeeded);
LLVM_DEBUG(dbgs() << "LAA: We need to do " << RtCheck.getNumberOfChecks()
<< " pointer comparisons.\n");
// If we can do run-time checks, but there are no checks, no runtime checks
// are needed. This can happen when all pointers point to the same underlying
// object for example.
if (CanDoRT)
RtCheck.Need = RtCheck.getNumberOfChecks() != 0;
RtCheck.Need = NeedRTCheck;
bool CanDoRTIfNeeded = !RtCheck.Need || CanDoRT;
bool CanDoRTIfNeeded = !NeedRTCheck || CanDoRT;
if (!CanDoRTIfNeeded)
RtCheck.reset();
return CanDoRTIfNeeded;

View File

@ -2795,8 +2795,8 @@ void InnerLoopVectorizer::emitMemRuntimeChecks(Loop *L, BasicBlock *Bypass) {
std::tie(FirstCheckInst, MemRuntimeCheck) =
addRuntimeChecks(MemCheckBlock->getTerminator(), OrigLoop,
RtPtrChecking.getChecks(), RtPtrChecking.getSE());
assert(MemRuntimeCheck && "no RT checks generated although RtPtrChecking "
"claimed checks are required");
if (!MemRuntimeCheck)
return;
if (MemCheckBlock->getParent()->hasOptSize()) {
assert(Cost->Hints->getForce() == LoopVectorizeHints::FK_Enabled &&