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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] Inconsistent results for affine.load and arith.minui
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

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

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

<pre>
    I have the following MLIR program:
test.mlir:
```
func.func @func1() -> f32 {
  %idx0 = index.constant 0
  %idx2 = index.constant 2
 %c1396717254_i64 = arith.constant 1396717254 : i64
  %c792_i64 = arith.constant 792 : i64

  %alloc_115 = memref.alloc() : memref<1x5xi64>
  linalg.fill ins(%c792_i64 : i64) outs(%alloc_115 : memref<1x5xi64>)

  %99 = affine.load %alloc_115[%idx0, %idx2] : memref<1x5xi64>
  
  // can not replace %99 with %c792_i64
  %105 = arith.xori %99, %c1396717254_i64 : i64

  %158 = arith.minui %105, %c1396717254_i64 : i64
  vector.print %158 : i64
  
  %159 = arith.subi %158, %c1396717254_i64 : i64
  vector.print %159 : i64
  %0 = arith.sitofp %159 : i64 to f32
  return %0 : f32
}
```
When I ran ```/data/tmp/v1102/llvm-project/build/bin/mlir-opt --lower-affine --convert-vector-to-llvm --convert-index-to-llvm --convert-linalg-to-loops --convert-scf-to-cf --finalize-memref-to-llvm --convert-arith-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1102/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1102/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1102/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got the result of:
```
1396717022
-232
-2.320000e+02
```
However, when I ran ```/data/tmp/v1102/llvm-project/build/bin/mlir-opt --int-range-optimizations --lower-affine --convert-vector-to-llvm --convert-index-to-llvm --convert-linalg-to-loops --convert-scf-to-cf --finalize-memref-to-llvm --convert-arith-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1102/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1102/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1102/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got the result of:
```
1396717254
0
0.000000e+00
```
The above two results seem to be inconsistent. I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused these results.

My git version is 33bdb53d864e3e244d8fd5649062f17b7d4c958d.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVk2PozgQ_TXOpWRkzFc45NDdmWgj7VxWK-2xZaAgHhkb2Sbpnl-_MpAOvZ3Rzs5qbiNFAcpV75Vdz3YJ52SnEXckeyTZfiNGfzJ2dxG6ezW6-xKLTWWa190RTuKM4E8IrVHKXKTu4PPvxz9gsKazoifJA2F7wh48Oh_1Sto3C8nZ8ps-21HXUfgDkrLwjAnfEl4CJcknaBMOpHicXQEIz2TzwoAke5C6wZeoNtp5oT2w9z78ng9ffAjP6jgp8yIueJY-yzydvIWV_nTzvnkASR5A5umKoi5K_q3AouTvI1ZxQilTP8dxNgX22Ftso8m4TDsEzmaSPMUv2UtAST5dIZTUQnVRK5UCqd0UtE5mZuUlmNEvo2vK-9i8_JBnWc4za1upMVJGNO-yD_qYa0H403XJSbb_t_RvDAfCD1ALDdp4sDgoUeNCfJH-tF7jVVoxy1Yr_mKsnGOWLD5W9X4V4my7gumlHuWC_j1AAGesvbHRYKX2N7z3GlmzlSs2N1ZyiflRsvKOINmaQnrTDv_wBW_CdrqGWPSj1dfIh9sQKfZ3N-pfJ9RwBCs03Eb4oRFeEH7w_UD44RzHjBN-UOrc08GaL1h7wg_VKFUTnlITfginATWDB0qVuaCls8iA0troM1pP5xlTb2gAWg1M-_mOfd4V04Axg1uNuLoN5roFStvgJb8inQV6B2davjv2cC6tzBZro2upkI7a4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