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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 09:01:02 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 this is essentially simplifying a three way compare.  We've recently added three way compares to IR, and we've got analogous simplification logic inside SCEV for min/max.  Should we maybe have an interface on SCEV which does the 3 way compare, and returns either the result or a SCEVCouldNotCompute?

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


More information about the llvm-commits mailing list