Issue 148939
Summary [AArch64] Cannot scalarize scalable vector loads
Labels backend:AArch64
Assignees
Reporter sjoerdmeijer
    Compiling this:

```
#include <algorithm>
short a;
bool b;
extern int c[][1][1];
void i(short d, long e, int f[][3][3], bool g[][3][3], unsigned h[][3][3]) {
  for (int l = 1; l < 21; l++)
    for (int j; j < 3; j += 2)
      for (long k; k < 3; k += e - 7) {
        b = ~(g[2][1][k] ? d : 0);
        a = f[1][1][2];
        c[1][0][j] = std::max((unsigned)3, h[2][3][2]);
      }
}
```

with `-std=c++11 -msve-vector-bits=128 -Ofast -mcpu=grace`, results in this error:

```
fatal error: error in backend: Cannot scalarize scalable vector loads
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -fno-verbose-asm -S -target aarch64-linux-gnu --gcc-toolchain=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu --sysroot=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot -fcolor-diagnostics -fno-crash-diagnostics -std=c++11 -w -msve-vector-bits=128 -Ofast -mcpu=grace <source>
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<source>'.
4.	Running pass 'AArch64 Instruction Selection' on function '@_Z1islPA3_A3_iPA3_A3_bPA3_A3_j'
 #0 0x0000000003c80a78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c80a78)
 #1 0x0000000003c7e44c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c7e44c)
 #2 0x0000000003bcec93 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bcec93)
 #3 0x0000000003c75c9e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c75c9e)
 #4 0x0000000000da44db LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000000003bd8bc3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bd8bc3)
 #6 0x0000000003bd8d28 (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bd8d28)
 #7 0x00000000052adec7 (/opt/compiler-explorer/clang-trunk/bin/clang+++0x52adec7)
 #8 0x00000000052f10f0 (anonymous namespace)::VectorLegalizer::Expand(llvm::SDNode*, llvm::SmallVectorImpl<llvm::SDValue>&) LegalizeVectorOps.cpp:0:0
 #9 0x00000000052f376d (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) LegalizeVectorOps.cpp:0:0
#10 0x00000000052fa0ec llvm::SelectionDAG::LegalizeVectors() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x52fa0ec)
#11 0x0000000005254e9c llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5254e9c)
```

See also:

https://godbolt.org/z/hrYqvWdq8


Unfortunately, this is requesting VLS code with `-msve-vector-bits=128`, but this is used in e.g. the Gromacs project. 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to