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

    <tr>
        <th>Summary</th>
        <td>
            [RISCV] <vscale x 1 x *> masked.load crashes with Zve32
        </td>
    </tr>

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

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

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

<pre>
    <vscale x 1 x *> types aren't legal with Zve32*. The type legalizer is unable to widen non-VP masked load. It currently asserts on a call getVectorNumElements which isn't valid for scalable vectors. Replacing that with getVectorElementCount crashes in legalizing concat_vectors due to the padding of the mask with 0 elements.

I don't think we can do the 0 element padding for scalable vectors. Probably the best thing to do is to widen using VP_LOAD and limit the VL instead of padding the mask.

CC: @preames @lukel97 @wangpc-pp 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0k89uozwUxZ_GbK6CiCF_WLDIlzZSpeqbqjPKYjbVtX0Dnhob2SZp5ulHhjTdzKww2Ofc37EOGIJuLVHDVv-x1UOGY-ycb6IbBvIyE05dG1buz0GiIfiAJXwA4ztWPkK8DhQAPVnGNxEMtWjgomMHP89UcsZ3OfzoaDo37-rf5EEHGC0KQxAdXLQiC9bZxfEFegzvpMA4VDk8RZCj92SjuQKGQD4GcBYQJBoDLcUjyej8_2P_aKgnGwNcOi070GEGOqPRCk7OQ4KfJp4nScjhlQaDUtsWYodxpr5b3vz2brQRpMfQUQBtPzMklXRWYny7-YEapzSxIxhQqXTCnabXlGm2L4BunDkrdqzYPYFyM2nstH2HC4FEC2r2uR-_O_49yYt3AoW5TiJBYXZrE45y6bLvtzyG9P348vb8bfcAaBUY3es4CY_PoG2IhCqBf078DHAD3u9ZuQNWFYMn7CmkpRnfydSbtLygbQe5GAbIVFOquqwxo2a5qTblZrNcr7OukZu6FoJQbEW12p4q4kpJoU6F2tbLUqpMN7zgq2K1XBfrklfrvDitthXWhdqeCl4LZFVBPWqTG3Puc-fbTIcwUrOsimW9zQwKMmEqM-eWLjDtMs5Tt32TRAsxtiGR6xDDl03U0Ux_wevT9_2RrR7gH7WfW5qnlt7L8dX6bPSm6WIcAit3jB8YP7Q6dqPIpesZP6R5t8di8O4Xycj4YaIMjB9uMc4N_xMAAP__vS41dA">