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

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 23:35:48 PDT 2023


qcolombet added a comment.

Hi,

The patch looks reasonable to me.
We need to fix the use of `getOperand(0)` and `getOperand(1)` everywhere.

I've highlighted a couple of these. I let you take a closer look.

Cheers,
-Quentin



================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:1050
+      return false;
+    return !MI.getOperand(0).getSubReg() && !MI.getOperand(1).getSubReg();
+  }
----------------
Instead of checking operand 0 and 1 directly, we should get the pair from `isCopyInstr` and check these.


================
Comment at: llvm/lib/CodeGen/CalcSpillWeights.cpp:228
+    bool identityCopy =
+        TII.isCopyInstr(*MI) &&
+        MI->getOperand(0).getReg() == MI->getOperand(1).getReg() &&
----------------
Similar comment, everywhere we introduce a `isCopyInstr`, we need to check the returned pair. 


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:2463
       const MachineOperand &Dest = MI.getOperand(0);
       const MachineOperand &Src = MI.getOperand(1);
       Register SrcReg = Src.getReg();
----------------
Ditto


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