Skip to content

Illegal copy from vector register to SGPR with outgoing inreg argument derived from allocas #140780

Open
@arsenm

Description

@arsenm
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s

declare void @user(ptr addrspace(5) inreg)

define amdgpu_kernel void @v_multiple_frame_indexes_literal_offsets() #0 {
  %vgpr = call i32 @llvm.amdgcn.workitem.id.x()
  %alloca0 = alloca [2 x i32], align 8, addrspace(5)
  %alloca1 = alloca i32, align 4, addrspace(5)
  %cmp = icmp eq i32 %vgpr, 0
  %select = select i1 %cmp, ptr addrspace(5) %alloca0, ptr addrspace(5) %alloca1
  call void @user(ptr addrspace(5) inreg %select)
  ret void
}

declare noundef range(i32 0, 1024) i32 @llvm.amdgcn.workitem.id.x() #1

attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
# After Eliminate PHI nodes for register allocation

*** Bad machine code: illegal copy from vector register to SGPR ***
- function:    v_multiple_frame_indexes_literal_offsets
- basic block: %bb.0  (0x15384d338)
- instruction: $sgpr0 = COPY killed %17:vgpr_32
LLVM ERROR: Found 1 machine code errors.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions