| Issue |
240534
|
| Summary |
[RISCV] Crash in LowerOperation (BUILD_VECTOR) with +experimental-p,+zve64x,+zilsd on i64 load/store
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
christian-herber-qcom
|
llc segfaults during DAG legalization when P, Zve64x and Zilsd are all enabled. The input is plain scalar i64 volatile loads and stores, with no vector code.
```
target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
target triple = "riscv32-unknown-elf"
define i1 @cas(ptr %p, ptr %expected, i64 %desired) {
entry:
%0 = load volatile i64, ptr %p, align 8
%1 = load i64, ptr %expected, align 8
%cmp = icmp eq i64 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then:
store volatile i64 %desired, ptr %p, align 8
br label %cleanup
if.end:
%2 = load volatile i64, ptr %p, align 8
store i64 %2, ptr %expected, align 8
br label %cleanup
cleanup:
ret i1 %cmp
}
```
`llc -mtriple=riscv32 -mattr=+experimental-p,+zve64x,+zilsd -O2 repro.ll`
Reproduces on trunk (Compiler Explorer):
```
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-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=riscv32 -mattr=+experimental-p,+zve64x,+zilsd -O2 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@cas'
#0 0x0000000000886188 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x886188)
#1 0x00000000008830ed SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x0000717082845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#3 0x00000000033781ba llvm::SelectionDAG::createOperands(llvm::SDNode*, llvm::ArrayRef<llvm::SDValue>) (/opt/compiler-explorer/clang-trunk/bin/llc+0x33781ba)
#4 0x000000000338fa89 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-trunk/bin/llc+0x338fa89)
#5 0x0000000001e41239 llvm::RISCVTargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1e41239)
#6 0x00000000032b9668 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#7 0x00000000032cbedf llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-trunk/bin/llc+0x32cbedf)
#8 0x00000000033cbfeb llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x33cbfeb)
#9 0x00000000033ce351 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x33ce351)
#10 0x00000000033cfd95 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x33cfd95)
#11 0x00000000033be781 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x33be781)
#12 0x000000000370a6b5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x370a6b5)
#13 0x0000000004e76f42 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x4e76f42)
#14 0x0000000004e77321 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x4e77321)
#15 0x0000000004e77e36 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x4e77e36)
#16 0x0000000000939f5a compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llcdriver.cpp:0:0
#17 0x000000000093ae52 llcMain (/opt/compiler-explorer/clang-trunk/bin/llc+0x93ae52)
#18 0x000000000080a70c main (/opt/compiler-explorer/clang-trunk/bin/llc+0x80a70c)
#19 0x000071708282a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#20 0x000071708282a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#21 0x0000000000865d95 _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x865d95)
Program terminated with signal SIGSEGV (11)
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs