Skip to content

[PowerPC] llc crashed at -O1/O2/O3: Assertion `isImm() && "Wrong MachineOperand mutator"' failed. #167672

@XChy

Description

@XChy

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

target datalayout = "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512"
target triple = "powerpc64le-unknown-linux-musl"

define <4 x i8> @backsmith_pure_1(<8 x i32> %0) {
entry:
  %shuffle = shufflevector <8 x i32> %0, <8 x i32> zeroinitializer, <4 x i32> <i32 5, i32 6, i32 7, i32 4>
  %conv4 = trunc <4 x i32> %shuffle to <4 x i8>
  %shift = shufflevector <4 x i8> %conv4, <4 x i8> zeroinitializer, <4 x i32> <i32 3, i32 poison, i32 poison, i32 poison>
  %foldExtExtBinop = and <4 x i8> %shift, %conv4
  ret <4 x i8> %foldExtExtBinop
}

llc output:

llc: /root/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h:686: void llvm::MachineOperand::setImm(int64_t): Assertion `isImm() && "Wrong MachineOperand mutator"' 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 'PowerPC MI Peephole Optimization' on function '@backsmith_pure_1'
 #0 0x00000000041c2638 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x41c2638)
 #1 0x00000000041bf4e4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000074619e442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000074619e4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000074619e442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000074619e4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000074619e42871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000074619e439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000001cd3d5e (anonymous namespace)::PPCMIPeephole::simplifyCode() PPCMIPeephole.cpp:0:0
 #9 0x0000000001cd7288 (anonymous namespace)::PPCMIPeephole::runOnMachineFunction(llvm::MachineFunction&) PPCMIPeephole.cpp:0:0
#10 0x00000000030a1219 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#11 0x00000000036f0a06 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f0a06)
#12 0x00000000036f0db1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f0db1)
#13 0x00000000036f161f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f161f)
#14 0x00000000008fca42 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#15 0x00000000007c84f9 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c84f9)
#16 0x000074619e429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#17 0x000074619e429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#18 0x00000000008f1275 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f1275)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions