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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] sort the operands of Commutative operations as part of CSE in a deterministic way
        </td>
    </tr>

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

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

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

<pre>
    [D123492](https://reviews.llvm.org/D123492) added the ability to remove commutative operations but had a correctness issue since it sorted operands that are op results based on their pointers, which could cause identical regions to be considered not equivalent. [D154699](https://reviews.llvm.org/D154699) reverted this change to fix the correctness issue. Instead, we should sort operands of  Commutative operations in a determinstic way during CSE.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMksFynDgQhp9GXLo8BQLGcOCw69mp2nOeoJEa6JSQJupmHL99ChzHcSWpyokDv9T_96lRhOdINJj2X9NeCtx0SXnQtEZUjMWY_Mv-71LZuumtaS_GdovqTUz9j7FXY6-Z7kzPcgrhvp5Sno29vqVtD-g9edCFAEcOrC-gCTKt6U7g0rpuisp3gnSjjMopCoybwoIeEFzKmZxGEgEW2QiEoyNgBUlZyb8ei15AF1TAvF8EmWQLKjCi7JG4j-cMt8RRKYuxT_C8sFvApS14cLgJAXuKyg4DZJqPHppg3EtGYU-ZPMSkQF82vmOgqCc4vLTNue__2str2vaQ6U4HgS4s4BaMM-0TJ_562PoF_QT_R1FCf9QnkOUov3t4t5AmgKffW-UICJ6U8spRlB084wv4LXOc4enTf6fCD7Xv6x4LGqpz15dl15dNsQzoy963tqtLh3aytZ1sa31btq5x59Z1BQ-2tHX5WJXVY9nZ6tT2U-3Gxjqsq6kdK9OUtCKHHy6KA2k4149dUwQcKcjbBuZhDz2M2yymKQOLvisslDUcu7oGzqa9vOLvvn5W8AcDKHDD3da0834Uwm9Gii2H4eNDzqzLNp5cWo297lW-fx5uOX0mp8ZeDxwx9noQfQsAAP__Nl8hFA">