[Mlir-commits] [mlir] [mlir][affine] Use affine symbol for RHS of `divMod` expressions (PR #107976)

Alessandro Potenza llvmlistbot at llvm.org
Wed Sep 2 02:17:48 PDT 2026


https://github.com/alepot55 commented:

I built this on today's main. The `Utils.cpp` change is still the only source change
needed, and `getDivMod` is still the only place in tree that builds a floordiv or a mod
with a dim on the right, so there is nothing else to convert alongside it.

The test hunk has gone stale though: #116703 split that file, and the maps you are
updating now live in `affine-expand-index-ops-as-affine.mlir`. With only the source
change applied, that is the single failing test in `check-mlir`, and what it prints there
is

```
#map1 = affine_map<()[s0, s1, s2] -> ((s2 mod (s0 * s1)) floordiv s0)>
#map2 = affine_map<()[s0, s1, s2] -> ((s2 mod (s0 * s1)) mod s0)>
```

with `map1` and `map2` applied to `[%DIM2, %DIM1, %IDX]`. Same value as before, just a
different numbering of the symbols.


https://github.com/llvm/llvm-project/pull/107976


More information about the Mlir-commits mailing list