Skip to content

[AMDGPU] Backend assertion hit during codegen #66899

@jhuber6

Description

@jhuber6

The AMDGPU backend hits an assertion while attempting to get a register for the following reduced code https://godbolt.org/z/46dccMErP. This only occurs with assertions enabled and seems to work fine with a standard build.

target triple = "amdgcn-amd-amdhsa"

define void @foo() #0 {
  %1 = alloca [2 x i8], align 1, addrspace(5)
  %2 = getelementptr [2 x i8], ptr addrspace(5) %1, i32 0, i32 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %.._crit_edge_crit_edge, %0
  store i8 1, ptr addrspace(5) %2, align 1
  br label %3

3:                                                ; preds = %3, %._crit_edge
  %4 = phi i64 [ 1, %3 ], [ 0, %._crit_edge ]
  %5 = trunc i64 %4 to i32
  %6 = getelementptr i8, ptr addrspace(5) %1, i32 %5
  %7 = load i8, ptr addrspace(5) %6, align 1
  %8 = getelementptr i8, ptr null, i64 %4
  store i8 %7, ptr %8, align 1
  br i1 false, label %.._crit_edge_crit_edge, label %3

.._crit_edge_crit_edge:                           ; preds = %3
  br label %._crit_edge
}

attributes #0 = { "target-cpu"="gfx1030" }
**llc: /root/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h:370: llvm::Register llvm::MachineOperand::getReg() const: Assertion `isReg() && "This is not a register operand!"' failed.**

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions