[llvm] [DA] Fix absolute value calculation (PR #164967)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 08:30:52 PDT 2025


================
@@ -1582,6 +1582,23 @@ static const SCEV *minusSCEVNoSignedOverflow(const SCEV *A, const SCEV *B,
   return nullptr;
 }
 
+/// Returns the absolute value of \p A. In the context of dependence analysis,
+/// we need an absolute value in a mathematical sense. If \p A is the signed
+/// minimum value, we cannot represent it unless extending the original type.
+/// Thus if we cannot prove that \p A is not the signed minimum value, returns
+/// nullptr.
+static const SCEV *absSCEVNoSignedOverflow(const SCEV *A, ScalarEvolution &SE) {
----------------
kasuga-fj wrote:

I chose Overflow to make the name consistent with the function `minusSCEVNoSignedOverflow` above.

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


More information about the llvm-commits mailing list