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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 03:57:35 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);
----------------
nikic wrote:

I think taking a normal SCEV min/max would be fine in terms of correctness, but as you say, profitability is less clear. I also suspect that the logic used here may be stronger than what SCEV does for this particular case. SCEV only uses isKnownViaNonRecursiveReasoning to simplify min/max expression. (Of course, it can also be weaker in other respects...)

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


More information about the llvm-commits mailing list