[llvm] [BasicAA] Track nuw through decomposed expressions (PR #106512)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 02:09:11 PDT 2024


================
@@ -444,20 +448,22 @@ static LinearExpression GetLinearExpression(
         E = GetLinearExpression(Val.withValue(BOp->getOperand(0), false), DL,
                                 Depth + 1, AC, DT);
         E.Offset += RHS;
+        E.IsNUW &= NUW;
----------------
nikic wrote:

Proof for add nuw associativity: https://alive2.llvm.org/ce/z/oiNosh

And counter-proof that the current NSW code here is incorrect: https://alive2.llvm.org/ce/z/Ga8-CT

We are missing a pre-condition: https://alive2.llvm.org/ce/z/wkP_yw

But this is unrelated to this patch...

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


More information about the llvm-commits mailing list