[PATCH] D119078: [LAA, LV] Add initial support for pointer-diff memory checks.
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 7 17:05:22 PST 2022
reames added inline comments.
================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:312
+ }
+ auto *Diff = SE->getMinusSCEV(SinkStartInt, SrcStartInt);
+ DiffChecks.emplace_back(Diff, AllocSize);
----------------
This bit makes me uncomfortable. The recent direction of changes to SCEV seem to be leading us towards disallowing pointer subtractions involving distinct memory objects. This change very much relies on the historical behavior of doing an implicit inttoptr. See the comment of doing getMinusSCEV.
In fact, I think you are accidentally only applying this new logic in the case where we can prove the two accesses share a common base object.
If you're okay documenting that restriction, we can punt the pointer_subtract semantics question one step further down the road.
================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:1634
+ ConstantInt::get(Ty, IC * C.second));
+ auto *Diff = Expander.expandCodeFor(C.first, Ty, Loc);
+ Value *IsConflict =
----------------
Somewhat an aside, but this is one more place where having a general SCEV note for a predicate would seem useful. In this case, we'd cache the overlap predicate directly, and the emission code wouldn't need to be so closely coupled.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119078/new/
https://reviews.llvm.org/D119078
More information about the llvm-commits
mailing list