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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] vector insert/extract canonicalization
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          sri-cherukuri
      </td>
    </tr>
</table>

<pre>
    Trivial extract-insert copy does not folded by vector canonicalization patterns
```
  %0 = arith.constant dense<0> : vector<2xi32>
  %1 = vector.extract %arg0[0] : i32 from vector<2xi32>
  %2 = vector.extract %arg0[1] : i32 from vector<2xi32>
  %3 = vector.insert %1, %0[0] : i32 into vector<2xi32>
  %4 = vector.insert %2, %3[1] : i32 into vector<2xi32>
```
`%4` should be replaced with `%arg0`

https://godbolt.org/z/jY37h8T1Y
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMk81uozAUhZ_msrGC7GsckgWLNClP0E2X_iO44-DINpmmTz-CEE0VTUaVEEjg891zjw4yJXccrG1AvIA4FHLMfYhNim6lexvHX2N0hQrm2rxFd3HSE_uZo9R55YZkYyY6nK_EBJvIEDLpgjfWEHUlF6tziETLIQxOS---ZHZhIGeZs41DArqDNV0uuiMEUFAC_EBkdLkvdRhSlkMmxg7JAt9T4K8E-G4hA9_jp-MI_PUuZ7P89rlcbE7vZTxSEC8UxGEGOI6ki-H0nIT_J7Gfk_h30hLZZBVwP2_86MsNOTynVf-m4ULjj96e0r5HP91RVLCmJPVh9IYoS6I9e6mtIb9d7sntyLz9TUJ3fc7nBHwH2AK2x2BU8LkM8QjYfgG2H--87jdv7L0wDTdbvpWFbVgtBLKabuqib7rO1myNqlaq01JpJpCZzm6rDo0yiheuQYqCbpiglG1oXVLRUVFtO7pW64pJARW1J-l86f3lNM0uXEqjbZjgNROFl8r6NDcb8eRdBMSp47GZzq_UeExQUe9STn8J2WU__w2zQNzTJre0Adt7HR6bXYzRNw-puNyPqtThBNhOE5bH6hzDh9UTbTacANvF86XBPwEAAP__2h8UYA">