[PATCH] D53496: AMDGPU: Rewrite SILowerI1Copies to always stay on SALU

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 06:47:06 PDT 2018


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, rampitec, tpr.
Herald added subscribers: eraman, t-tye, dstuttard, yaxunl, mgorny, wdng, jvesely, kzhuravl.

Instead of writing boolean values temporarily into 32-bit VGPRs
if they are involved in PHIs or are observed from outside a loop,
we use bitwise masking operations to combine lane masks in a way
that is consistent with wave control flow.

Move SIFixSGPRCopies to before this pass, since that pass
incorrectly attempts to move SGPR phis to VGPRs.

This should recover most of the code quality that was lost with
the bug fix in "AMDGPU: Remove PHI loop condition optimization".

There are still some relevant cases where code quality could be
improved, in particular:

- We often introduce redundant masks with EXEC. Ideally, we'd have a generic computeKnownBits-like analysis to determine whether masks are already masked by EXEC, so we can avoid this masking both here and when lowering uniform control flow.

- The criterion we use to determine whether a def is observed from outside a loop is conservative: it doesn't check whether (loop) branch conditions are uniform.

Change-Id: Ibabdb373a7510e426b90deef00f5e16c5d56e64b


Repository:
  rL LLVM

https://reviews.llvm.org/D53496

Files:
  lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  lib/Target/AMDGPU/SIFixSGPRCopies.cpp
  lib/Target/AMDGPU/SILowerI1Copies.cpp
  lib/Target/AMDGPU/Utils/AMDGPULaneDominator.cpp
  lib/Target/AMDGPU/Utils/AMDGPULaneDominator.h
  lib/Target/AMDGPU/Utils/CMakeLists.txt
  test/CodeGen/AMDGPU/i1-copy-from-loop.ll
  test/CodeGen/AMDGPU/i1-copy-phi.ll
  test/CodeGen/AMDGPU/inline-asm.ll
  test/CodeGen/AMDGPU/llvm.amdgcn.div.fmas.ll
  test/CodeGen/AMDGPU/loop_break.ll
  test/CodeGen/AMDGPU/multi-divergent-exit-region.ll
  test/CodeGen/AMDGPU/multilevel-break.ll
  test/CodeGen/AMDGPU/select-opt.ll
  test/CodeGen/AMDGPU/sgpr-control-flow.ll
  test/CodeGen/AMDGPU/si-annotate-cf.ll
  test/CodeGen/AMDGPU/valu-i1.ll
  test/CodeGen/AMDGPU/waitcnt-looptest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53496.170403.patch
Type: text/x-patch
Size: 58181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181022/7b04c354/attachment.bin>


More information about the llvm-commits mailing list