[llvm] RegisterPressure: Uncomment out assert (PR #87405)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 10:51:37 PDT 2024


================
@@ -64,7 +64,7 @@ static void increaseSetPressure(std::vector<unsigned> &CurrSetPressure,
 static void decreaseSetPressure(std::vector<unsigned> &CurrSetPressure,
                                 const MachineRegisterInfo &MRI, Register Reg,
                                 LaneBitmask PrevMask, LaneBitmask NewMask) {
-  //assert((NewMask & !PrevMask) == 0 && "Must not add bits");
+  assert((NewMask & ~PrevMask).none() && "Must not add bits");
----------------
kparzysz wrote:

Line 783 should most likely be `PreviousMask |= LiveOut`.  When I do that, the following tests fail in "check-llvm-codegen":

```
Failed Tests (21):
  LLVM :: CodeGen/AMDGPU/amdgpu.private-memory.ll
  LLVM :: CodeGen/AMDGPU/coalesce-vgpr-alignment.ll
  LLVM :: CodeGen/AMDGPU/dag-divergence-atomic.ll
  LLVM :: CodeGen/AMDGPU/global_atomics.ll
  LLVM :: CodeGen/AMDGPU/global_atomics_i64.ll
  LLVM :: CodeGen/AMDGPU/insert_vector_dynelt.ll
  LLVM :: CodeGen/AMDGPU/itofp.i128.ll
  LLVM :: CodeGen/AMDGPU/lds-misaligned-bug.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.atomic.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.raw.ptr.buffer.atomic.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.atomic.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.struct.ptr.buffer.atomic.ll
  LLVM :: CodeGen/AMDGPU/llvm.amdgcn.struct.ptr.buffer.load.format.ll
  LLVM :: CodeGen/AMDGPU/load-global-i32.ll
  LLVM :: CodeGen/AMDGPU/load-local-i32.ll
  LLVM :: CodeGen/AMDGPU/merge-stores.ll
  LLVM :: CodeGen/AMDGPU/promote-alloca-globals.ll
  LLVM :: CodeGen/AMDGPU/sgpr-copy.ll
  LLVM :: CodeGen/AMDGPU/spill-agpr.ll
  LLVM :: CodeGen/AMDGPU/v_mac.ll
```

At least one test fails because `UseMask` has more bits set in it than `LiveLanes` in `RegPressureTracker::bumpUpwardPressure`.  I think there is some issue with how the lane masks are calculated/adjusted.

The tests I used is
```
llc -mtriple=amdgcn -mcpu=tonga -amdgpu-atomic-optimizer-strategy=None -mattr=-flat-for-global -verify-machineinstrs llvm/test/CodeGen/AMDGPU/global_atomics.ll -o -
```


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


More information about the llvm-commits mailing list