aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-07-14 17:23:31 +0100
committerFlorian Hahn <flo@fhahn.com>2024-07-14 17:24:12 +0100
commit3ccda936710d55d819c56cf4f2cf307c2d632b63 (patch)
treeb1ca394bfb4bf086eb837933b24ef7ab180bf8a9 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent3aae4caffa3134d4edd1811fd2c35cbc95eb7441 (diff)
downloadllvm-3ccda936710d55d819c56cf4f2cf307c2d632b63.zip
llvm-3ccda936710d55d819c56cf4f2cf307c2d632b63.tar.gz
llvm-3ccda936710d55d819c56cf4f2cf307c2d632b63.tar.bz2
[LAA] Update pointer-bounds cache to also consider access type.
The same pointer may be accessed with different types and the bound includes the size of the accessed type to compute the end. Update the cache to correctly disambiguate between different accessed types.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 018861a..91994f3 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -206,12 +206,13 @@ RuntimeCheckingPtrGroup::RuntimeCheckingPtrGroup(
static std::pair<const SCEV *, const SCEV *> getStartAndEndForAccess(
const Loop *Lp, const SCEV *PtrExpr, Type *AccessTy,
PredicatedScalarEvolution &PSE,
- DenseMap<const SCEV *, std::pair<const SCEV *, const SCEV *>>
- &PointerBounds) {
+ DenseMap<std::pair<const SCEV *, Type *>,
+ std::pair<const SCEV *, const SCEV *>> &PointerBounds) {
ScalarEvolution *SE = PSE.getSE();
auto [Iter, Ins] = PointerBounds.insert(
- {PtrExpr, {SE->getCouldNotCompute(), SE->getCouldNotCompute()}});
+ {{PtrExpr, AccessTy},
+ {SE->getCouldNotCompute(), SE->getCouldNotCompute()}});
if (!Ins)
return Iter->second;