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

    <tr>
        <th>Summary</th>
        <td>
            llc crashes with llvm.aarch64.sve.whilelt lowering to invalid <vscale x 1 x s8> type
        </td>
    </tr>

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

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

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

<pre>
    I've lowered a matmul kernel from MLIR to LLVM IR successfully, using SVE vector operations. However, when attempting to compile the resulting LLVM IR to assembly using llc, I encountered a segmentation fault. The crash appears to happen in the section of the code that uses the `llvm.aarch64.sve.whilelt.nxv4i1.i64` intrinsic.

I'm not entirely sure what's causing this, but I noticed that at some point during the compilation, a SVE vector of type `<vscale x 1 x s8>` appears in the IR. I'm not an SVE expert, but the use of a single-lane vector with 8-bit elements looks suspicious and possibly invalid in this context.

I've isolated a minimal example that reproduces the crash on Compiler Explorer (Godbolt):
https://godbolt.org/z/KWhvcMK61

The code doesn’t do anything meaningful, it's just a reduced version of the original kernel, trimmed to the part that triggers the crash.

Let me know if there's anything else I can provide to help debug this, thanks in advance!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0VMGS2zYM_Rr6glmNTNmSddAhTdatJ5vLNpOeKQqWmKVIDQHKdr--Q8nubjvtybRI4D08PEARmd4hNmL_i9h_2ajIgw_NF0U-bFrf3ZqTkNWMYP0FA3agYFQ8RgtvGBxaOAc_wreX0yuwh5eXH9_g9AoUtUaic7T2JuRniGRcD7__eIYZNfsAfsKg2HhHGfzmLzhjSO8uAzpQzDhOnCLYg_bjZCwCDwgBKdrl4gHEHhQRjq293UGs1SnTCdBpHx3fSRP2IzpeMOGsouUMvg8IOigaQE0TqkAp3ZDODoxbEAn1EuHPy1_tu8REMURCWj6JMrd2HjOlgh7KXUYzZpfBWLScueu8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