llvm / llvm/llvm-project

[AMDGPU] Machine verifier reports undefined VGPRs after SI post-RA bundler when storing `<2 x i63>` to nullptr

Open
#199,350 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed crash-on-valid generated by fuzzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Live Reproducer: https://godbolt.org/z/n3z1j5Pa3

Compiling the following LLVM IR (which has immediate UB) with llc -verify-machineinstrs aborts with LLVM ERROR: Found 2 machine code errors. after the SI post-RA bundler reports 2 uses of undefined physical VGPRs.
Note that removing the br instruction the error disappears.

target triple = "amdgcn-amd-amdhsa"

define void @repro(<16 x i64> %a, <2 x i63> %b) {
entry:
  br label %bb
bb:
  store <2 x i63> %b, ptr null, align 1
  ret void
}

llc command:

llc -verify-machineinstrs repro.ll

Error output:

# After SI post-RA bundler
# Machine code for function repro: NoPHIs, TracksLiveness, NoVRegs, TiedOpsRewritten, TracksDebugUserValues
...
*** Bad machine code: Using an undefined physical register ***
- function:    repro
- basic block: %bb.0 entry (0x3d49cef8)
- instruction: renamable $vgpr1 = V_AND_B32_e32 2147483647, $vgpr1, implicit $exec
- operand 2:   $vgpr1

*** Bad machine code: Using an undefined physical register ***
- function:    repro
- basic block: %bb.0 entry (0x3d49cef8)
- instruction: renamable $vgpr2 = V_AND_B32_e32 2147483647, killed $vgpr2, implicit $exec
- operand 2:   killed $vgpr2
LLVM ERROR: Found 2 machine code errors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the live Godbolt reproducer and run llc -verify-machineinstrs repro.ll on the shown LLVM IR. Inspect the machine code after the SI post-RA bundler, focusing on the undefined physical VGPR uses reported by the machine verifier. Done means this reproducer no longer reports those errors while preserving verifier checking.

Written by the indexing model from the issue text.

Assessment

Domain
backend, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.