[llvm] 709ea8b - [RISCV] Simplify BP initialisation

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 04:34:21 PST 2021


Author: luxufan
Date: 2021-02-17T20:33:20+08:00
New Revision: 709ea8bc87810b6cd6a3a4a79663303a95519063

URL: https://github.com/llvm/llvm-project/commit/709ea8bc87810b6cd6a3a4a79663303a95519063
DIFF: https://github.com/llvm/llvm-project/commit/709ea8bc87810b6cd6a3a4a79663303a95519063.diff

LOG: [RISCV] Simplify BP initialisation

We can re-use copyPhysReg rather than writing a specialised copy.

Differential Revision: https://reviews.llvm.org/D95227

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVFrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 55045f817d51..5ff1e5061f50 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -507,9 +507,7 @@ void RISCVFrameLowering::emitPrologue(MachineFunction &MF,
       // 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);
       }
     }
   }


        


More information about the llvm-commits mailing list