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

    <tr>
        <th>Summary</th>
        <td>
            [DAG] SDPatternMatch - m_Zero can't see through bitcasts
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            llvm:codegen
      </td>
    </tr>

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

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

<pre>
    X86 uses ISD::isBuildVectorAllZeros to peek through bitcasts to match zero vectors in a large number of combines.

Ideally we'd use SDPatternMatch to match these combines and use m_Zero() instead, but regrettably this fails to match the zero vectors through bitcasts,

https://github.com/llvm/llvm-project/commit/84397c61f44e62231d1876a745a0c1f74ea8a5b8 shows an example of the regression

If we convert m_Zero() to something closer to m_AllOnes / AllOnes_match we might be able to make this work.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk0-PnDgQxT-NuZSmBQVuw4EDM61ejVarXe1IUZTLyH8KcMbglm26M_n0EXRnopmccsKCquK9Xz3LGO0wE7WM3zN-yOSSRh_a__9-spOfM-XNa_u53sMSKcLj04GVHSs7G-8X68wn0smHzrkvFHyE5OFE9AJpDH4ZRlA2aRnT9mGSSY_wnYKH89YVwc4gwckwEMzLpCiA70H7SdmZ4o7lHcu7R0PSuVe4EENhVhXwdPhPpkRh_mcb-TY7jRTprR_kfC2fnldxDGuGDdg5JpKG4QOoJUGgIVBKUrlXSKON0Evr4ruR7yV_dMbw4apzTOkUVzZ4ZHgcbBoXtdN-Ynh07vzzcXcK_ivpxPCo_TTZ9VBXZSP0vuirivaIZWGKWuylqLjMddGLimQtuaohjv6y2gL6JqeTo5XWKnAzEaP18w1ZD5eVw3ymkN7bTx6inyiNdh5AOx8pbGafO-f-XaExPMLt_HxFcCGY7DAmUARSObrCeaErr4sPL7vMtKVpykZm1BaiEoKX-32TjW1Z9BUq3aAmJfZSSYO56gmx5EIX2mS2xRx5zjEveC6qemdQ5IZzI8q8ajhyVuU0Set2K72dD0NmY1yoLapcVDxzUpGLW3QRB-8N9DbEBFsRQ1zXg7gtoOy0NzTQvL7mhyy020LUMkRW5c7GFH_9JNnkthtx6P5i_PAxcnc3qqDlzFAkiES_RSNbgmv_OBab8sjweHN4bvFHAAAA___TbDS3">