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

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 06:50:20 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) {
----------------
amehsan wrote:

nit: maybe use "NoSignedWrap" instead of "NoSignedOverflow" for the consistency of the name?

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


More information about the llvm-commits mailing list