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

    <tr>
        <th>Summary</th>
        <td>
            [GlobalISel] CSEMIRBuilder has no LegalizerInfo
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    

It folds G_CTLZ and G_CTTZ when the input is a constant:
https://github.com/llvm/llvm-project/blob/8326fb2626836ca4d95f30a67f7836dd2b4c1031/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp#L278

For both opcodes the input and output type may differ. The CSEMIRBuilder can create illegal constants after the legalizer without knowing.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUUsFu3CAQ_Rp8GdUyg83aBx-apI5WSi9NTrlUYIY1LQHL4Ky2X1_ZTdptb73AwGie3nvzVEruFIh61tyw5q5Qa57i0uc0TivlXOhoLj2r7lj18dd5zGCjNwnuv94-PTyDCmYvn57hPFGAPBG4MK8ZXAIFYwwpq5CZeJufcp7T9sKB4XByeVp1OcYXhoP3r-_Xh3mJ32jMDAfto2Y4tAKl1ShRtkKOqjZdY0Wl5MEeWiGNQV2PvBL8Csdtc7fR0D0FhsO9j1r54yP57fvx0-fjl5vVeUNLOc4zQ_GAh_Za6hAX0DFPEOcxGkpX2jbVcc1bmS8zwYu6gHHW0lLC00TwFzyMKsC4kMoEzns6Kf_blwTKZlp26L3jftACZ5enuGb4HuLZhVNZmF6YTnSqoJ4fsEXssJPF1Etha9vUqLk01laWKmO4NdbWHW9UqwrXY4U1ryrJm5oLWWoSB2s1b-TBtEic1RW9KOfLzbUyLqfCpbRSzznHDguvNPm0pwMx0Bn2LkPcwrL0-670ekqsrrxLOf2ByS77PVZXvjd3_zgzqQQhwsO78mOwsVgX3_93THZeieHwRvy1x58BAAD__2tQ66s">