Skip to content

llc -mtriple=wasm32-unknown-wasip1 -wasm-enable-sjlj crash #135796

Open
@cpunion

Description

@cpunion
LLVM ERROR: Cannot select: 0x125818c70: ch = catchret 0x126605238, BasicBlock:ch<if.end.split 0x12681a700>, BasicBlock:ch<_llgo_0 0x1268133e0>

Both on macOS and Ubuntu 24.04, LLVM 20.1.2

Full stack trace:

/opt/homebrew/Cellar/llvm/20.1.2/bin/llc -filetype=obj -o /Users/lijie/Library/Caches/go-build/22/22f0a0faa15fa263adf87306cf3ca84e5080038c54c2937e1cc0a0a5b1f607dc-d.ll.o -mtriple=wasm32-unknown-wasip1 -relocation-model=pic -O2 -exception-model=wasm -wasm-enable-sjlj /Users/lijie/Library/Caches/go-build/22/22f0a0faa15fa263adf87306cf3ca84e5080038c54c2937e1cc0a0a5b1f607dc-d.ll
LLVM ERROR: Cannot select: 0x125818c70: ch = catchret 0x126605238, BasicBlock:ch<if.end.split 0x12681a700>, BasicBlock:ch<_llgo_0 0x1268133e0>
In function: github.com/goplus/llgo/_demo/defer.main
PLEASE submit a bug report to https://github.com/Homebrew/homebrew-core/issues and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/homebrew/Cellar/llvm/20.1.2/bin/llc -filetype=obj -o /Users/lijie/Library/Caches/go-build/3b/3bf96b08f75901240780bf41867077a136f15e8fb74b52ecaf364c6ed9b9398b-d.ll.o -mtriple=wasm32-unknown-wasip1 -relocation-model=pic -O2 -exception-model=wasm -wasm-enable-sjlj /Users/lijie/Library/Caches/go-build/3b/3bf96b08f75901240780bf41867077a136f15e8fb74b52ecaf364c6ed9b9398b-d.ll
1.	Running pass 'Function Pass Manager' on module '/Users/lijie/Library/Caches/go-build/3b/3bf96b08f75901240780bf41867077a136f15e8fb74b52ecaf364c6ed9b9398b-d.ll'.
2.	Running pass 'WebAssembly Instruction Selection' on function '@"github.com/goplus/llgo/_demo/defer.main"'
 #0 0x000000011139b954 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x3d83954)
 #1 0x000000011139bd40 SignalHandler(int) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x3d83d40)
 #2 0x000000018e6dede4 (/usr/lib/system/libsystem_platform.dylib+0x180482de4)
 #3 0x000000018e6a7f70 (/usr/lib/system/libsystem_pthread.dylib+0x18044bf70)
 #4 0x000000018e5b4908 (/usr/lib/system/libsystem_c.dylib+0x180358908)
 #5 0x0000000111379838 llvm::report_fatal_error(llvm::StringRef, bool) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x3d61838)
 #6 0x000000011151438c llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x3efc38c)
 #7 0x000000010e0220ac llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0xa0a0ac)
 #8 0x0000000110a9bc78 (anonymous namespace)::WebAssemblyDAGToDAGISel::Select(llvm::SDNode*) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x3483c78)
 #9 0x000000010e016e88 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x9fee88)
#10 0x000000010e014300 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x9fc300)
#11 0x000000010e01255c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x9fa55c)
#12 0x000000010e010e10 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x9f8e10)
#13 0x000000010db7de88 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x565e88)
#14 0x000000010d8dfa24 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x2c7a24)
#15 0x000000010d8eb6c0 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x2d36c0)
#16 0x000000010d8e1ce4 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/homebrew/Cellar/llvm/20.1.2/lib/libLLVM.dylib+0x2c9ce4)
#17 0x000000010413eca8 main (/opt/homebrew/Cellar/llvm/20.1.2/bin/llc+0x100002ca8)
#18 0x000000018e328274

My input .ll file doesn't contains catchret instruction. When add -debug-pass=Structure -print-after-all, print a very long code that contains catchret instruction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions