| Issue |
243804
|
| Summary |
[CodeGenPrepare] Crash in CodeGenPrepare::optimizeInst
|
| Labels |
backend:RISC-V,
llvm:codegen,
crash,
crash-on-valid
|
| Assignees |
|
| Reporter |
fhahn
|
The following function triggers a crash in `CodeGenPrepare`:
https://llvm.godbolt.org/z/aosx4PaGr
```
; bin/llc
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64"
define <vscale x 2 x ptr> @kernel(ptr %a) {
entry:
%0 = call <vscale x 2 x i64> @llvm.stepvector.nxv2i64()
%1 = call i64 @llvm.vscale.i64()
%2 = shl i64 %1, 1
br label %vector.body
vector.body:
%vec.ind = phi <vscale x 2 x i64> [ %0, %entry ], [ %vec.ind.next, %vector.body ]
%broadcast.splatinsert = insertelement <vscale x 2 x i64> zeroinitializer, i64 %2, i64 0
%broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32> zeroinitializer
%vec.ind.next = add <vscale x 2 x i64> %vec.ind, %broadcast.splat
br i1 false, label %middle.block, label %vector.body
middle.block:
%wide.gep = getelementptr [8 x i8], ptr %a, <vscale x 2 x i64> %vec.ind
ret <vscale x 2 x ptr> %wide.gep
}
```
```
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 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'CodeGen Prepare' on function '@kernel'
#0 0x00000000008474b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8474b8)
#1 0x00000000008442a4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8442a4)
#2 0x000000000084441e SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007029ee645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x0000000004f94cad llvm::LoopInfoBase<llvm::BasicBlock, llvm::Loop>::getLoopFor(llvm::BasicBlock const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4f94cad)
#5 0x0000000003c0f6f5 (anonymous namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, (anonymous namespace)::ModifyDT&) CodeGenPrepare.cpp:0:0
#6 0x0000000003c11207 (anonymous namespace)::CodeGenPrepare::_run(llvm::Function&) CodeGenPrepare.cpp:0:0
#7 0x0000000003c13c6e (anonymous namespace)::CodeGenPrepareLegacyPass::runOnFunction(llvm::Function&) (.part.0) CodeGenPrepare.cpp:0:0
#8 0x0000000005833483 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x5833483)
#9 0x00000000058338c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x58338c1)
#10 0x0000000005834289 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x5834289)
#11 0x0000000000909fa2 compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llcdriver.cpp:0:0
#12 0x000000000090b18b llcMain (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x90b18b)
#13 0x00000000007d1b1c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7d1b1c)
#14 0x00007029ee62a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#15 0x00007029ee62a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#16 0x0000000000826145 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x826145)
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