<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/83676>83676</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Missing canonicalization `min(..., 64) ceilDiv 64` to1
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MaheshRavishankar
      </td>
    </tr>
</table>

<pre>
    I have a use case where I need to canonicalize the following sequence of operations

```
#map = affine_map<(d0) -> (d0 * -64 + 1000, 64)>
#map3 = affine_map<(d0) -> (d0 ceildiv 64)>
%6 = scf.forall (%arg0, %arg1) in (16, 8) shared_outs(%arg2 = %5) -> (tensor<1000x500xi32>) {
    %7 = affine.min #map(%arg0)
    %11 = affine.apply #map3(%7)
}
```

`%11` is always 1. 

I first tried a hack which is the top commit in this branch https://github.com/MaheshRavishankar/llvm-project/tree/aie_pad_pack_hack. This works and gives me the right result. 

I tried to solve this properly in the top commit in this branch https://github.com/MaheshRavishankar/llvm-project/tree/aie_pad_pack (the `HEAD^1` in the same commit as the branch above). The issue here is that the for the right way, it is needed to prove that `%arg0` is lower bounded by 0, but I have no way of specifying that without teaching the expr simplification about `scf.forall` op. 

Any thoughts @matthias-springer or @Groverkss 

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE1v6zYQ_DX0ZRGBor6sgw5JHLc5vEvRu7GSViJrSlRJyo776wtSbp5fUxQ9FTAMi9bOzuwOB51T40zUsOKFFYcdrl4a23xDSU7-ghflJM5ntLvW9LfmHSReCBBWR9ChI7hKsgTvMBP14A10OJtZdajVHwReEgxGa3NV8wiOfl9p7gjMAGYhi16Z2TF-YPz5_l3y-2d7FNmEC7DsADgMaqbThAvLXpnY95yJGp5Y9gbxCZh4hqcyByZeIOWcM_EKZc5EzbK3R7Tsv8F1pHSvLl8gijLWu25IBmNR6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