[llvm] [BasicAA] Handle wrapping of pointer arithmetic (PR #69116)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 12:24:06 PDT 2023


================
@@ -417,7 +417,8 @@ static LinearExpression GetLinearExpression(
                                 Depth + 1, AC, DT);
         E.Offset <<= RHS.getLimitedValue();
         E.Scale <<= RHS.getLimitedValue();
-        E.IsNSW &= NSW;
+        // The nsw flag has different semantics for shift and mul.
+        E.IsNSW = false;
----------------
dtcxzyw wrote:

Sorry for my misunderstanding. `shl nsw %a, c1` is equivalent to `mul nsw %a, (1<<c1)`.
Alive2: https://alive2.llvm.org/ce/z/clpceU
I have found the root cause of this issue. I will propose a fix soon.


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


More information about the llvm-commits mailing list