<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58700>58700</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][arith] `arith.div*` ops should not be marked as `AlwaysSpeculatable`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kuhar
</td>
</tr>
</table>
<pre>
Currently all arith ops are [marked as 'Pure'](https://github.com/llvm/llvm-project/blob/aceb67eeb516fd4ca762de6bd8194ca7f31c9f45/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td#L24) which [entails 'AlwaysSepculatable'](https://github.com/llvm/llvm-project/blob/cb33ef7ca71d864b5fb8efbe59d77e895ba6e9a0/mlir/include/mlir/Interfaces/SideEffectInterfaces.td#L133). Instead, they should be marked as `ConditionallySpeculatable` and take into account possible division by 0 or division by -1 in the signed case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylkt1q3DAQhZ_GvhExsmxL8oUvNkkLC4WW7hPoZ7xWo7WMJCfs23fsJGxDoRAKhtGMLOl8c0YHex0e1hhhzv5KlPdERZcnEpaEKyBFd39R8QksUYkUTPxYI2AouseCySnnJRXNoWBf8TvjuVVXJlww8f75PdwtMfwCkzHVPmgMyoDmAkB3NR9ta5TgzALXVtb9lo1Nbfqx7fDXi3cRg5uNXy3cCo9O-dc7D5tejMef78n3JVXZFqz5xtqC9eRlcmbaSBBSOb9zHPyLuqYTLGb1Kivt_5_K6KaBUaD-2kre6m7UEkYNXW-FANl3WnHoFf0H1XHOEEdsT8Lk5Cx8GUd841Z-46qbBsEqcpxTBoWlB5InuJI0hdVbooH8YRqnD2G2Lrswo7_X0wI3Zk6Jmi3J6gmIm3MgypiwzpksISWHfxDrnl3Co0RfCSUhfijc1Xhqe5okd57xPaMSVCUMNecCvZRMlnZobN_0qswuexi2gdpgsdXd_T5ruNxE7usKby_YYdO1TeAbzxzyX0xvBn6EKdfoh0_751Ja9453UlBaTkPTUSV1D5oCFQJtpdgW0Ta91J3kqi290uDTxlIw9uodQ4zSDYwyVtOmpl1LmawkF0bTFgSWLeW2aClccAarTUIV4rmMw65Gr-eEm96lnG6bKu193bu23a_WPIU4PK2TiuUue9g1_wYDYjha">