[PATCH] D98040: [AMDGPU][GlobalISel] Improve constant offset lookup for llvm.amdgcn.s.buffer

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 08:57:45 PDT 2021


mbrkusanin updated this revision to Diff 369114.
mbrkusanin added a comment.

I revisited this again to try to find a way to eliminate these cross reg bank copies but I wasn't able to find an efficient solution. Looking through uses of dst of G_CONSTANT at the time of selecting a bank for that instruction does not help since RegBank is not working backwards.

One idea that does work is to instead of making a cross reg bank copy to a constant to simply recreate a new G_CONSTANT with required bank (change is in RegBankSelect::repairReg). This can help with the current problem but produces less optimal solutions in a lot of tests. In some cases instead of an SGPR, an extra VPGR will be used instead. And in cases where same constant needs to be used as both SGPR and VGPR there can also be an additional s/v_mov instruction.

Here we can at least hide copy check inside matcher.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98040/new/

https://reviews.llvm.org/D98040

Files:
  llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
  llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp
  llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/merge-s-buffer-loads.ll
  llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98040.369114.patch
Type: text/x-patch
Size: 7335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210827/d153c462/attachment.bin>


More information about the llvm-commits mailing list