Skip to content

[PowerPC] crashed at -O1: LLVM ERROR: Found 1 machine code errors. #159116

@XChy

Description

@XChy

Reproducer: https://godbolt.org/z/dW4Mn4xvv
Testcase:

define i32 @func_1(i64 %vecext24) {
entry:
  br label %asm.fallthrough

asm.fallthrough:                                  ; preds = %cond.end, %entry
  %BS_VAR_11.2 = phi i8 [ %conv8, %cond.end ], [ 0, %entry ]
  %conv7 = sext i8 %BS_VAR_11.2 to i32
  %rem = srem i32 %conv7, 7
  %conv8 = trunc i32 %rem to i8
  %cmp.scalar = icmp slt i32 %conv7, 0
  %vecins = insertelement <4 x i16> zeroinitializer, i16 0, i64 %vecext24
  %vecinit26 = insertelement <32 x i8> zeroinitializer, i8 0, i64 0
  %conv58 = sext <32 x i8> %vecinit26 to <32 x i32>
  %vecext59 = extractelement <32 x i32> %conv58, i64 0
  %cmp122 = icmp ult i32 %vecext59, 1
  br i1 %cmp122, label %cond.true, label %cond.end

cond.true:                                        ; preds = %asm.fallthrough
  %vecext124 = extractelement <4 x i16> %vecins, i64 0
  %conv125 = sext i16 %vecext124 to i32
  br label %cond.end

cond.end:                                         ; preds = %cond.true, %asm.fallthrough
  %cond = phi i32 [ %conv125, %cond.true ], [ 1, %asm.fallthrough ]
  store i32 %cond, ptr null, align 4
  br label %asm.fallthrough
}

Output:

LLVM ERROR: Found 1 machine code errors.
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 'PowerPC MI Peephole Optimization' on function '@func_1'
 #0 0x00000000040de748 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x40de748)
 #1 0x00000000040db5f4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000077e66bc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000077e66bc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000077e66bc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000077e66bc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00000000007b44ff llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
 #7 0x000000000311c0af (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x311c0af)
 #8 0x00000000031342b6 llvm::MachineFunction::verify(llvm::Pass*, char const*, llvm::raw_ostream*, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31342b6)
 #9 0x0000000001c73219 (anonymous namespace)::PPCMIPeephole::runOnMachineFunction(llvm::MachineFunction&) PPCMIPeephole.cpp:0:0
#10 0x0000000002ff7209 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#11 0x000000000362ea98 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362ea98)
#12 0x000000000362ecd1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362ecd1)
#13 0x000000000362f53f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362f53f)
#14 0x00000000008eafcd compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#15 0x00000000007bc2e6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7bc2e6)
#16 0x000077e66bc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#17 0x000077e66bc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#18 0x00000000008e1425 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8e1425)
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