Skip to content

[WebAssembly] llc crashed at -O1/O2/O3 and triggered assertion "!WebAssembly::isArgument(MI.getOpcode())" #165589

@XChy

Description

@XChy

Reproducer: https://godbolt.org/z/5zY4esjsK
Testcase:

target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-wasi"

define i32 @func_70(ptr %spec.select) {
entry:
  br label %BS_LABEL_1

BS_LABEL_1:                                       ; preds = %BS_LABEL_1, %entry
  %l_127.0 = phi ptr [ undef, %entry ], [ %spec.select, %BS_LABEL_1 ]
  store i32 0, ptr %l_127.0, align 4
  callbr void asm sideeffect "", "!i"()
          to label %asm.fallthrough [label %BS_LABEL_1]

asm.fallthrough:                                  ; preds = %BS_LABEL_1
  ret i32 0
}

llc output:

llc: /root/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp:288: virtual bool {anonymous}::WebAssemblyExplicitLocals::runOnMachineFunction(llvm::MachineFunction&): Assertion `!WebAssembly::isArgument(MI.getOpcode())' 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 -O1 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'WebAssembly Explicit Locals' on function '@func_70'
 #0 0x00000000041966e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x41966e8)
 #1 0x0000000004193594 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000079e31e642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000079e31e6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000079e31e642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000079e31e6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000079e31e62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000079e31e639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000002166ac7 (anonymous namespace)::WebAssemblyExplicitLocals::runOnMachineFunction(llvm::MachineFunction&) WebAssemblyExplicitLocals.cpp:0:0
 #9 0x000000000307cb79 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#10 0x00000000036cac96 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36cac96)
#11 0x00000000036cb041 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36cb041)
#12 0x00000000036cb8af llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36cb8af)
#13 0x00000000008f93c3 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#14 0x00000000007c6a16 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c6a16)
#15 0x000079e31e629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#16 0x000079e31e629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#17 0x00000000008ee805 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8ee805)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions