[llvm] [AMDGPU] Fix GCUpwardRPTracker. (PR #74328)

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 11:23:41 PST 2023


================
@@ -666,3 +625,70 @@ body: |
     EXP_DONE 0, %49:vgpr_32, undef %51:vgpr_32, undef %53:vgpr_32, undef %55:vgpr_32, -1, 0, 1, implicit $exec
     S_ENDPGM 0
 ...
+---
+name: early_clobber_def_used_on_rhs
+registers:
+  - { id: 0, class: vgpr_32 }
+body: |
+  ; RPU-LABEL: name: early_clobber_def_used_on_rhs
+  ; RPU: bb.0:
+  ; RPU-NEXT:   Live-in:
+  ; RPU-NEXT:   SGPR  VGPR
+  ; RPU-NEXT:   0     0
+  ; RPU-NEXT:   0     1      dead %3:vgpr_32 = COPY $vgpr0
+  ; RPU-NEXT:   0     0
+  ; RPU-NEXT:   0     1      early-clobber %2:vgpr_32 = COPY %0:vgpr_32
----------------
vpykhtin wrote:

On the other hand `MachineFunctionProperties::Property::TracksLiveness` property that is required by _LiveIntervals_ has the following description, `include/llvm/CodeGen/MachineFunction.h:143:`
```
  // TracksLiveness: True when tracking register liveness accurately.
  //  While this property is set, register liveness information in basic block
  //  live-in lists and machine instruction operands (e.g. implicit defs) is
  //  accurate, kill flags are conservatively accurate (kill flag correctly
  //  indicates the last use of a register, an operand without kill flag may or
  //  may not be the last use of a register). This means it can be used to
  //  change the code in ways that affect the values in registers, for example
  //  by the register scavenger.
```
This may mean that 'undef' flag should have been set manually in the testcase to be valid so I'm not sure. Maybe I should just add a test with 'undef' flag and get away with it.

https://github.com/llvm/llvm-project/pull/74328


More information about the llvm-commits mailing list