Issue 235538
Summary [AMDGPU] "Using an undefined physical register" after SI post-RA bundler
Labels new issue
Assignees
Reporter petar-jovanovic
    The machine verifier rejects the bundle formed from this MIR, although the input itself verifies (`-run-pass=none`). Reproduced on `main` at ea1b5425bc71.

```mir
---
name: store_pair
tracksRegLiveness: true
body:             |
  bb.0:
 liveins: $vgpr0, $vgpr4_vgpr5

    GLOBAL_STORE_DWORD $vgpr4_vgpr5, killed $vgpr0, 0, 0, implicit $exec
    $vgpr2 = IMPLICIT_DEF
 GLOBAL_STORE_DWORDX2 $vgpr4_vgpr5, $vgpr2_vgpr3, 8, 0, implicit $exec
 S_ENDPGM 0
...
```

```
$ llc -mtriple=amdgpu9.00 -run-pass=si-post-ra-bundler repro.mir -o /dev/null
# At end of pipeline
...
*** Bad machine code: Using an undefined physical register ***
- function:    store_pair
- basic block: %bb.0
- instruction: BUNDLE implicit-def $vgpr2, implicit $vgpr4_vgpr5, implicit killed $vgpr0, implicit $exec, implicit $vgpr2_vgpr3
- operand 4:   implicit $vgpr2_vgpr3

*** Bad machine code: Using an undefined physical register ***
- function: store_pair
- basic block: %bb.0
- instruction: GLOBAL_STORE_DWORDX2 $vgpr4_vgpr5, $vgpr2_vgpr3, 8, 0, implicit $exec
- operand 1: $vgpr2_vgpr3
LLVM ERROR: Found 2 machine code errors.
```

`-mtriple=amdgpu12.00 -run-pass=si-insert-hard-clauses` fails the same way. It also happens in full compiles, e.g.
`llc -mtriple=amdgpu8.02 -verify-machineinstrs -stress-regalloc=48 llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll`, which succeeds without `-verify-machineinstrs`.

Related: #178010 (closed as fixed by #183146) and #139102 (fixed by #142563) report the same error.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to