Issue 176578
Summary [AMDGPU] Assertion `isReg() && "This is not a register operand!"' failed.
Labels backend:AMDGPU, crash-on-valid, generated by fuzzer
Assignees
Reporter XChy
    Reproducer: https://godbolt.org/z/s6Terfz9E
```llvm
; llc -O2
target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
target triple = "amdgcn-amd-amdhsa"

define <4 x i8> @backsmith_pure_8() {
entry:
  %0 = tail call i32 @llvm.amdgcn.msad.u8(i32 0, i32 0, i32 0)
 br label %for.body

for.body:                                         ; preds = %for.end, %entry
  %BS_VAR_1.0101 = phi i8 [ 0, %entry ], [ %spec.select, %for.end ]
  %1 = tail call i32 @llvm.amdgcn.perm(i32 %0, i32 0, i32 0)
  %2 = and i32 %1, 1
  %tobool.not.not.not = icmp ne i32 %2, 1
 %spec.select = select i1 %tobool.not.not.not, i8 0, i8 %BS_VAR_1.0101
  br i1 %tobool.not.not.not, label %for.cond.cleanup50, label %for.end

for.end: ; preds = %for.body
  tail call void null(<4 x i8> zeroinitializer, <2 x i8> zeroinitializer)
  br label %for.body

for.cond.cleanup50:                               ; preds = %for.body
  %vecinit67 = insertelement <4 x i8> zeroinitializer, i8 %spec.select, i64 0
  ret <4 x i8> %vecinit67
}

; Function Attrs: nocallback nofree nounwind speculatable willreturn memory(none)
declare i32 @llvm.amdgcn.perm(i32, i32, i32) #0

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.amdgcn.msad.u8(i32, i32, i32) #1

attributes #0 = { nocallback nofree nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
```

Dump:
```
llc: /root/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h:373: llvm::Register llvm::MachineOperand::getReg() const: Assertion `isReg() && "This is not a register operand!"' 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 -O2 <source>
1.	Running pass 'CallGraph Pass Manager' on module '<source>'.
2.	Running pass 'SI peephole optimizations' on function '@backsmith_pure_8'
 #0 0x0000000004252608 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4252608)
 #1 0x000000000424f4e4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000077b154842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000077b1548969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000077b154842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000077b1548287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000077b15482871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000077b154839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000001136b43 (anonymous namespace)::SIPreEmitPeephole::optimizeVccBranch(llvm::MachineInstr&) const (.isra.0) SIPreEmitPeephole.cpp:0:0
 #9 0x0000000001137587 (anonymous namespace)::SIPreEmitPeephole::run(llvm::MachineFunction&) (.constprop.0) SIPreEmitPeephole.cpp:0:0
#10 0x0000000001138f04 (anonymous namespace)::SIPreEmitPeepholeLegacy::runOnMachineFunction(llvm::MachineFunction&) SIPreEmitPeephole.cpp:0:0
#11 0x000000000311d0e9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#12 0x0000000003773256 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3773256)
#13 0x0000000002b690c8 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#14 0x0000000003773e6f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3773e6f)
#15 0x00000000008eb34d compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#16 0x00000000007c6f8c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c6f8c)
#17 0x000077b154829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#18 0x000077b154829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#19 0x00000000008e03f5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8e03f5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to