[llvm] [RISCV][MCP] Remove redundant move from tail duplication (PR #89865)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 21:56:43 PDT 2024


================
@@ -424,9 +424,11 @@ void RISCVInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
   const TargetRegisterInfo *TRI = STI.getRegisterInfo();
 
   if (RISCV::GPRRegClass.contains(DstReg, SrcReg)) {
-    BuildMI(MBB, MBBI, DL, get(RISCV::ADDI), DstReg)
-        .addReg(SrcReg, getKillRegState(KillSrc))
-        .addImm(0);
+    auto MI = BuildMI(MBB, MBBI, DL, get(RISCV::ADDI), DstReg)
+                  .addReg(SrcReg, getKillRegState(KillSrc))
+                  .addImm(0);
+    MI->getOperand(0).setIsRenamable(MBBI->getOperand(0).isRenamable());
----------------
efriedma-quic wrote:

MBBI is, in general, not related to the copy, I think.  According to the interface definition, it's just the insertion point.

https://github.com/llvm/llvm-project/pull/89865


More information about the llvm-commits mailing list