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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64][SVE] Error in llvm.experimental.stepvector
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          stevesuzuki-arm
      </td>
    </tr>
</table>

<pre>
    `llvm.experimental.stepvector` https://godbolt.org/z/bvb4GMeaj
```
define <vscale x 6 x i32> @step_nxv6i32() #0 {
    %1 = call <vscale x 6 x i32> @llvm.experimental.stepvector.nxv6i32()
    ret <vscale x 6 x i32> %1
}
declare <vscale x 6 x i32> @llvm.experimental.stepvector.nxv6i32()
```
Crashes with target triple = "aarch64-linux-gnu" -mattr=+sve2 -O3
The same error happens with `<vscale x 12 x i32>`, `<vscale x 24 x i32>` and more.

```
WidenVectorResult #0: t2: nxv6i32 = step_vector TargetConstant:i32<1>

Do not know how to widen the result of this operator!
UNREACHABLE executed at /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:3564!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mattr=+sve2 -O3 <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'AArch64 Instruction Selection' on function '@step_nxv6i32'
 #0 0x00005558a779a40f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00005558a7797e7c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fac3841f3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
 #3 0x00007fac37eec03b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4303b)
 #4 0x00007fac37ecb859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00005558a76dc9ca (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x30dc9ca)
 #6 0x00005558a763a47a llvm::DAGTypeLegalizer::WidenVectorResult(llvm::SDNode*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x303a47a)
 #7 0x00005558a75fc5d8 llvm::DAGTypeLegalizer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2ffc5d8)
 #8 0x00005558a75fd726 llvm::SelectionDAG::LegalizeTypes() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2ffd726)
 #9 0x00005558a7590a43 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f90a43)
#10 0x00005558a75945a3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f945a3)
#11 0x00005558a7595cd8 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.960) SelectionDAGISel.cpp:0:0
#12 0x00005558a6ad6116 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x24d6116)
#13 0x00005558a6f84a96 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2984a96)
#14 0x00005558a6f84de9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2984de9)
#15 0x00005558a6f85729 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2985729)
#16 0x00005558a513e598 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#17 0x00005558a5098937 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xa98937)
#18 0x00007fac37ecd0b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b3)
#19 0x00005558a5134f6a _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xb34f6a)
Compiler returned: 139
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFWF1z2jgU_TXmRQNjy98PPAAhbWeSNtNku4-MLAtwYySPJFPSX79XwnzIoWl2l9nNYLAk-9xz7r26klKI8mXsJX5dbzcjtmuYrDaMa1KPlGbNllEtJAyjtdaN8sKJh2_hsxJlIWo9EnIFrZ9wFdsi-nDPyHfPv_H8CbzSfWyzZMuKM-SFs62ipGZohxK4qhB74Rx5kW-MLfhum5gunHk4Rx4OfeSl0z0Cgj8PxwFg3CCAqN8Ae0vLyDFywpZM_xIRzHaq0puDHloT-Zagv8uh57CZJGrNFPpR6TXSRK6AnpZVUzPrAA9jQiRdJ9Gwrni7G654C31ouCFaS3jCw1O1ZdDxJdwDPq0ZUmTDEJNSSLQmTcN4h2-sngkJ8FGJGcGz_gM4On8AEV6ijZBs1Cm5pOfPqmT8m1X_lam21ja8kE9IY_PdecSKs7mw9xR6stJngitNuIYnrdlZYEyfWbsRiAuNnrn4gdZwaQHKwCLSIFvuDYoltCqFBMSEmKzGXVT_-Px1Ppl9nEzv5ojtGG01KxExDG-lEBp-TDCHjRTfgVTXND9VAd8zUbIPjMPdI6thvBL8ZvIBmndsRerqJ9urfnppmBrRpgENYZxER-sPd_PJ4xyptthUGhFUtCtg3AipjYretINotcWIis0ZC5dbpVTLFNzYsFSc1m3JrBuoSSlUEPqsJaGHaD1q6EBluzHE9l0-DOUPUqwk2SDwf2sS2JAwHhGNsQIMmqpmcggZXkPopemrCV8NiVJMGieooZYtfzaloeKWJ0VDYSAg9QxQq5tWjxQa7rIEXtsM1QvMkx1kQMU1qy_msplwSrSSsmMCBIbt15bziq9QA-bBRHrbchsJ9GA67gknK8MxRdC1EWVrphFOHTCcdh7BlwAnEzvb0CdIRNnusY_x7oCXB6MGul_S0q7U2Krm73z4i-M4I2mak8hfog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