[PATCH] D109553: [SCEV] Attempt to define what flags are legal on a SCEV

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 10 12:32:06 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:13512
               getMulExpr(getUDivExpr(URemLHS, URemRHS), URemRHS,
-                         (SCEV::NoWrapFlags)(SCEV::FlagNUW | SCEV::FlagNSW));
           RewriteMap[V] = Multiple;
----------------
efriedma wrote:
> I think the expression here is naturally nuw: `(X /u Y) * Y` must be less than or equal to X.  No idea why it's getting marked nsw, though.
> 
> Anyway, we can deal with various violations (e.g. ScalarEvolution::getGEPExpr) in future patches.
I agree on the definitional nature of the nuw.  I'll simplify point out that because it is definitional, it should be in getMulExpr, not here.  Interestingly, it's not.  

I'd still argue for removing here since it appears to have no test coverage.

I hadn't noticed the issue in getGEPExpr previously, that one is nasty.   I'm going to go ahead and file a bug to keep track of the issues as we find them.


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

https://reviews.llvm.org/D109553



More information about the llvm-commits mailing list