[llvm] [LAA] Use computeConstantDifference() (PR #103725)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 09:40:05 PDT 2024


================
@@ -412,12 +412,10 @@ bool RuntimePointerChecking::needsChecking(
 /// Return nullptr in case we couldn't find an answer.
 static const SCEV *getMinFromExprs(const SCEV *I, const SCEV *J,
                                    ScalarEvolution *SE) {
-  const SCEV *Diff = SE->getMinusSCEV(J, I);
----------------
preames wrote:

Off topic, but in a slightly different way... It looks like the sole user of this is addPointer.  I can't see any reason that the Min and Max can't simply be the SCEV expressions for the min and max of all pointers.  We'd need to cost whether generating such a group is profitable, but that's distinct from legality.  One concern is that I think the current logic is relying on the min/max simplification to fail when two pointers are based on different underlying objects.  We'd need to explicitly handle that.  There may also be a profitability concern about forming "too large" a group if the offsets are runtime values with non-overlapping ranges.  

https://github.com/llvm/llvm-project/pull/103725


More information about the llvm-commits mailing list