[PATCH] D104319: [SCEV] Retain AddExpr flags when subtracting a foldable constant.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 14:03:18 PDT 2021


efriedma added a comment.

For nuw, if adding a constant doesn't overflow, adding a smaller one doesn't overflow.  For nsw, similarly, if adding a constant doesn't overflow, adding a constant with the same sign and smaller magnitude doesn't overflow.

Not sure I like the way the logic is written here; it's not obvious that the above rules have a common subset, so it's sort of hard to follow.

I don't think the `AddExpr->getNumOperands() == 2` check is necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104319



More information about the llvm-commits mailing list