[PATCH] D76233: Affine expr simplification for add of const multiple of same expression

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 16 20:12:40 PDT 2020


bondhugula added a comment.

In D76233#1924892 <https://reviews.llvm.org/D76233#1924892>, @nicolasvasilache wrote:

> LGTM
>
> See: https://github.com/llvm/llvm-project/blob/master/mlir/lib/Dialect/SDBM/SDBMExpr.cpp#L31 in case you like something from there to write such expressions more idiomatically and wish to lift it up.
>  I am not claiming it is in a final state but you might find it useful.


Looks good and useful. You may also want to add the operator '/' for floordiv. This would be in general useful to implement some detection at least from under Analysis/. You could just consider moving it to lib/Analysis/Utils so that it's not a dependence on the SDBM dialect. One use case could have been to simplify (x - x floordiv d)  as x mod d, but we have this by construction in lib/IR/AffineExpr.cpp. Also, it may be useful to have a way to constrain an AffineExprMatcher to positive constants for example. But this is all meant for "post construction" matching as opposed to simplifying before / by construction itself, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76233





More information about the llvm-commits mailing list