[llvm] [BasicAA] Handle wrapping of pointer arithmetic (PR #69116)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 15 10:08:32 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;
----------------
nikic wrote:
This is conceptually right, but you should keep the nsw flag if you know that either RHS is a constant other than bitwidth-1 or the LHS is a constant other than -1.
Please split off this part of the patch with a minimal test that demonstrates that the current behavior is wrong in this specific edge case.
https://github.com/llvm/llvm-project/pull/69116
More information about the llvm-commits
mailing list