[PATCH] D113784: [RFC][AMDGPU][GlobalISel] Fix RegBanks for G_CONSTANT

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 18:01:28 PST 2021


arsenm added a comment.

Last time I thought about this I thought it would be easier to have the post-regbank combiner handle this. In some situations it makes most sense to completely rematerialize the constant value in each regbank, not just reassign it. If you have an inline constant, it would be better to just emit a new constant for each bank. For multiple uses of literals its trickier since there's a code size or instruction count tradeoff based on the uses



================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:324
       Reassign,
+      /// (Re)assign the register bank and remove all prevously inserted copies
+      ReassignAndRemoveCopies,
----------------
Typo prevously


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:325
+      /// (Re)assign the register bank and remove all prevously inserted copies
+      ReassignAndRemoveCopies,
       /// Mark this repairing placement as impossible.
----------------
I would expect to make the right decision upfront, not have to go back and erase copies


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h:626-631
+  virtual bool
+  canReassingRegBankForConst(const MachineOperand &MO,
+                             const RegisterBank &DstBank,
+                             const MachineRegisterInfo &MRI) const {
+    return false;
+  }
----------------
I think this is way too specific of a target hook


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113784



More information about the llvm-commits mailing list