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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 8 13:05:14 PDT 2021


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
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.
----------------
nit: are have, should be only one of them.


================
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);
----------------
I think it would be good to explicitly mention why NSW is not preserved here.


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