[PATCH] D115945: [AMDGPU][GlobalISel] Eliminate cross regbank copies of constants

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 09:41:15 PST 2022


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp:371
+
+  // Check if all uses of constant are copies to same regbank
+  for (MachineInstr &Use : MRI.use_nodbg_instructions(Dst)) {
----------------
arsenm wrote:
> This level of heuristic could have/should have been done by greedy regbankselect.
> 
> However, I think we want something a bit smarter here. We should rematerialize all uses that are inline constants. For literal constants, we can make a code size tradeoff based on the number of uses and if other operands are scalars
> For literal constants, we can make a code size tradeoff based on the number of uses and if other operands are scalars

Can't we do something simpler here and leave that kind of tradeoff to SIFoldOperands, which already makes that kind of decision?


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

https://reviews.llvm.org/D115945



More information about the llvm-commits mailing list