[PATCH] D150388: [CodeGen]Allow targets to use target specific COPY instructions for live range splitting

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 17:00:09 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:1970
+  virtual unsigned getLiveRangeSplitOpcode(Register reg,
+                                           MachineRegisterInfo &MRI) const {
+    return TargetOpcode::COPY;
----------------
MRI should be const


================
Comment at: llvm/lib/CodeGen/InlineSpiller.cpp:830
 
-  bool WasCopy = MI->isCopy();
+  bool WasCopy = TII.isCopyInstr(*MI) ? true : false;
   Register ImpReg;
----------------
Don't need ? true : false


================
Comment at: llvm/lib/CodeGen/LiveRangeEdit.cpp:352
+    if ((MI->readsVirtualRegister(Reg) &&
+         (TII.isCopyInstr(*MI) || MO.isDef())) ||
         (MO.readsReg() && (MRI.hasOneNonDBGUse(Reg) || useIsKill(LI, MO))))
----------------
swap these


================
Comment at: llvm/lib/CodeGen/LiveRangeShrink.cpp:201
           MachineInstr &DefInstr = *MRI.def_instr_begin(Reg);
-          if (!DefInstr.isCopy())
+          const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
+          if (!TII.isCopyInstr(DefInstr))
----------------
Move this to the function prolog


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150388



More information about the llvm-commits mailing list