diff options
author | Arthur Eubanks <aeubanks@google.com> | 2022-02-09 14:18:14 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2022-07-21 12:16:02 -0700 |
commit | 04d398db4694725df65482a90e06f213e1682c8f (patch) | |
tree | 804d914d69ae08f16fa084dfa5f34bc390b509ea /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 27945f9282030136cb8b043b91b229ea2758c9ed (diff) | |
download | llvm-04d398db4694725df65482a90e06f213e1682c8f.zip llvm-04d398db4694725df65482a90e06f213e1682c8f.tar.gz llvm-04d398db4694725df65482a90e06f213e1682c8f.tar.bz2 |
[LoopAccessAnalysis] Simplify D119047
No need to add checks for every type per pointer that we couldn't create
a check for the first time around, just the types that weren't
successful.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D119376
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 0bc2e76..d492a79 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -1011,7 +1011,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck, unsigned RunningDepId = 1; DenseMap<Value *, unsigned> DepSetId; - SmallVector<MemAccessInfo, 4> Retries; + SmallVector<std::pair<MemAccessInfo, Type *>, 4> Retries; // First, count how many write and read accesses are in the alias set. Also // collect MemAccessInfos for later. @@ -1049,7 +1049,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck, ShouldCheckWrap, false)) { LLVM_DEBUG(dbgs() << "LAA: Can't find bounds for ptr:" << *Access.getPointer() << '\n'); - Retries.push_back(Access); + Retries.push_back({Access, AccessTy}); CanDoAliasSetRT = false; } } @@ -1073,15 +1073,15 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck, // We know that we need these checks, so we can now be more aggressive // and add further checks if required (overflow checks). CanDoAliasSetRT = true; - for (auto Access : Retries) { - for (const auto &AccessTy : Accesses[Access]) { - if (!createCheckForAccess(RtCheck, Access, AccessTy, StridesMap, - DepSetId, TheLoop, RunningDepId, ASId, - ShouldCheckWrap, /*Assume=*/true)) { - CanDoAliasSetRT = false; - UncomputablePtr = Access.getPointer(); - break; - } + for (auto Retry : Retries) { + MemAccessInfo Access = Retry.first; + Type *AccessTy = Retry.second; + if (!createCheckForAccess(RtCheck, Access, AccessTy, StridesMap, + DepSetId, TheLoop, RunningDepId, ASId, + ShouldCheckWrap, /*Assume=*/true)) { + CanDoAliasSetRT = false; + UncomputablePtr = Access.getPointer(); + break; } } } |