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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 09:51:54 PST 2022


arsenm 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)) {
----------------
foad wrote:
> 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?
No, because these copies are also confusing selection patterns. I think we need to do both


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

https://reviews.llvm.org/D115945



More information about the llvm-commits mailing list