<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115293>115293</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] Inconsistent results for arith.ceildivsi
</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:
```
module {
func.func @func1() -> f32 {
%c1189465982_i64 = arith.constant 1189465982 : i64
%c-9223372036854775808_i64 = arith.constant -9223372036854775808 : i64
%156 = arith.ceildivsi %c-9223372036854775808_i64, %c1189465982_i64 : i64
vector.print %156 : i64
%0 = arith.sitofp %156 : i64 to f32
return %0 : f32
}
}
```
When I ran ```/data/tmp/v1107/llvm-project/build/bin/mlir-opt --int-range-optimizations --arith-expand --convert-arith-to-llvm --convert-vector-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1107/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1107/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1107/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got the result of:
```
-7754212542
-7.754212e+09
```
However, when I ran ```/data/tmp/v1107/llvm-project/build/bin/mlir-opt --arith-expand --convert-arith-to-llvm --convert-vector-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1107/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1107/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1107/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got the result of:
```
7754212542
7.754212e+09
```
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 1469d82e1cb3edc939d6b93089046edfef0cf36c.
</pre>
<img width="1px" height="1px" alt="" src="http://email.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