[AArch64] Assertion `isSVEorStreamingSVEAvailable() && "Tried to get SVE vector length without SVE support!"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer:
https://godbolt.org/z/Yn31hMjnj
Backtrace:
```console
llc: /root/llvm-project/llvm/lib/Target/AArch64/AArch64Subtarget.h:441: unsigned int llvm::AArch64Subtarget::getSVEVectorSizeInBits() const: Assertion `isSVEorStreamingSVEAvailable() && "Tried to get SVE vector length without SVE support!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel
1. Running pass 'Function Pass Manager' on module ''.
2. Running pass 'AArch64 load / store optimization pass' on function '@g'
#0 0x00000000045d3bc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x45d3bc8)
#1 0x00000000045d09f4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x45d09f4)
#2 0x00000000045d0b6a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f9a75c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f9a75c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007f9a75c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f9a75c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007f9a75c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007f9a75c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000000c0700f llvm::AArch64InstrInfo::isCandidateToMergeOrPair(llvm::MachineInstr const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xc0700f)
#10 0x0000000000e770cf (anonymous namespace)::AArch64LoadStoreOpt::tryToPairLdStInst(llvm::MachineInstrBundleIterator&) AArch64LoadStoreOptimizer.cpp:0:0
#11 0x0000000000e77a0b (anonymous namespace)::AArch64LoadStoreOpt::optimizeBlock(llvm::MachineBasicBlock&, bool) AArch64LoadStoreOptimizer.cpp:0:0
#12 0x0000000000e79c82 (anonymous namespace)::AArch64LoadStoreOptLegacy::runOnMachineFunction(llvm::MachineFunction&) AArch64LoadStoreOptimizer.cpp:0:0
#13 0x00000000033109b9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000039735b6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x39735b6)
#15 0x0000000003973961 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3973961)
#16 0x00000000039741cf llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x39741cf)
#17 0x00000000008ecb1a compileModule(char**, llvm::SmallVectorImpl&, llvm::LLVMContext&, std::__cxx11::basic_string, std::allocator>&) llc.cpp:0:0
#18 0x00000000007c2dfc main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c2dfc)
#19 0x00007f9a75c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007f9a75c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000008e18a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8e18a5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
This comes from the following C reproducer:
```c
void f(int *);
void __attribute__((aarch64_sve_pcs)) g(int *a) {
f(a);
}
```
Contributor guide
Research direction
Start by running the C reproducer through llc and inspect llvm/lib/Target/AArch64/AArch64Subtarget.h at getSVEVectorSizeInBits(), along with AArch64LoadStoreOptimizer.cpp and the isCandidateToMergeOrPair() call in the backtrace. The issue is done when the reproducer no longer triggers the assertion in the AArch64 load/store optimization pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100