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

    <tr>
        <th>Summary</th>
        <td>
            Suboptimal IR after new InstCombine transformation
        </td>
    </tr>

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

    <tr>
      <th>Assignees</th>
      <td>
            spatel-gh
      </td>
    </tr>

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

<pre>
    New transformation was introduced in [commit](https://github.com/llvm/llvm-project/commit/1a60ae02c65d26981017f59bc5918d3c2e363bfd).

Attached are:
1. reproducer - reprod.ll
2. result without the transformation - reprod-after-orig.ll
3. result with the transformation - reprod-after.ll

You can easily see that the IR we get without the transformation is very much simpler (simple select), while it gets expanded to long sequence after involving the new transformation.

To run reproduce:
> opt -S -O3 reprod.ll

[reprod-after.zip](https://github.com/llvm/llvm-project/files/8416094/reprod-after.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydUk1vnDAQ_TVwsUDGYD4OHDZJI-XSSk0vPdpgwJWxqT92u_31HWCTaDdSqlZC4xmP582bx3DTn9vP4oS8ZdoNxs7MS6PRiTkktbemD53owUURvevMPEsf0YeI1JP3i4vyQ0Qe4RulnwJP4QEESh1fjmSx5ofoPISXYvKYsRIzgUlX0p6UTZ3hrBpowzvaZHWfd0TkZc6HPiJNGuGHCB92e_CedROQYVasjbfLLEVWLDtNi5JLkCq1p8madkF5dAKGJnjkJ3E760tVwgYvbGKsHF8B8iuAv1e_Fu72uwmoYxoJ5qQ6IyegfGI7i6ev6CTQKD7kJh06CntGc-gm5OS8KBgT5N9dAFSbuk1E7tFpknAl_YrpkPi1MN2DXN4gZfQIb38GoTuBNqLwS49GHSUk1rb63Qpcaf_NIBv0m9Sv-kf5J2QWj5JnlHzJb-W_WHp3JdFvufznDg0woIOzLrISNwV474BJE_dt3jd5w2IvvRLtc-DAUM5MrZLvw6_jPmnn783Mpb5VPQ5Wtf9MTjoXNna0qCiOp5axPqc1z2k5EDzUvCyzsimagvKac9JUsWJcKNeCPqBHLFuCCcEFpriiNSx_hUlRV3XWYcHKSvCowGJmUqVr49TYMbbtxoGH0UFSSefdW5I5J0ctxIZPiFuYFyoZJ_DXdizA0tmWnWem5-BYvPFvN_J_AOc0WMw">