[RISCV] Simplify BP initialisation
We can re-use copyPhysReg rather than writing a specialised copy.
Differential Revision: https://reviews.llvm.org/D95227
GitOrigin-RevId: 709ea8bc87810b6cd6a3a4a79663303a95519063
diff --git a/lib/Target/RISCV/RISCVFrameLowering.cpp b/lib/Target/RISCV/RISCVFrameLowering.cpp
index 55045f8..5ff1e50 100644
--- a/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -507,9 +507,7 @@
// track the current stack after allocating variable sized objects.
if (hasBP(MF)) {
// move BP, SP
- BuildMI(MBB, MBBI, DL, TII->get(RISCV::ADDI), BPReg)
- .addReg(SPReg)
- .addImm(0);
+ TII->copyPhysReg(MBB, MBBI, DL, BPReg, SPReg, false);
}
}
}