[PATCH] D46756: [AMDGPU] Reworked SIFixWWMLiveness

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 07:13:57 PDT 2018


tpr created this revision.
Herald added subscribers: llvm-commits, t-tye, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, arsenm.

I encountered some problems with SIFixWWMLiveness when WWM is in a loop:

1. It sometimes gave invalid MIR where there is some control flow path to the new implicit use of a register on EXIT_WWM that does not pass through any def.

2. There were lots of false positives of registers that needed to have an implicit use added to EXIT_WWM.

3. Adding an implicit use to EXIT_WWM (and adding an implicit def just before the WWM code, which I tried in order to fix (1)) caused lots of the values to be spilled and reloaded unnecessarily.

This commit is a rework of SIFixWWMLiveness, with the following changes:

1. Instead of considering any register with a def that can reach the WWM code and a def that can be reached from the WWM code, it now considers three specific cases that need to be handled.

2. A register that needs liveness over WWM to be synthesized now has it done by adding itself as an implicit use to defs other than the dominant one.

Also added the following fixmes:

FIXME: We should detect whether a register in one of the above
categories is already live at the WWM code before deciding to add the
implicit uses to synthesize its liveness.

FIXME: I believe this whole scheme may be flawed due to the possibility
of the register allocator doing live interval splitting.

Change-Id: Ie7fba0ede0378849181df3f1a9a7a39ed1a94a94


Repository:
  rL LLVM

https://reviews.llvm.org/D46756

Files:
  lib/Target/AMDGPU/SIFixWWMLiveness.cpp
  test/CodeGen/AMDGPU/fix-wwm-liveness.mir
  test/CodeGen/AMDGPU/wqm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46756.146321.patch
Type: text/x-patch
Size: 26239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180511/55920565/attachment.bin>


More information about the llvm-commits mailing list