[PATCH] D103877: [SCEV] Keep common NUW flags when inlining Add operands.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 06:26:17 PDT 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:2547
     bool DeletedAdd = false;
+    // If the original flags and all inlined SCEVAddExprs are have NUW, use the
+    // common NUW flag for expression after inlining.
----------------
nikic wrote:
> nit: are have, should be only one of them.
Thanks, I'll fix that!


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:2548
+    // If the original flags and all inlined SCEVAddExprs are have NUW, use the
+    // common NUW flag for expression after inlining.
+    SCEV::NoWrapFlags CommonFlags = maskFlags(OrigFlags, SCEV::FlagNUW);
----------------
nikic wrote:
> I think it would be good to explicitly mention why NSW is not preserved here.
Sounds good, I'll add a comment in the committed version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103877/new/

https://reviews.llvm.org/D103877



More information about the llvm-commits mailing list