[llvm] 4575f35 - LocalStackSlotAllocation: Stop creating unused virtual register

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 06:31:20 PDT 2022


Author: Matt Arsenault
Date: 2022-04-20T09:31:14-04:00
New Revision: 4575f35ea15c71006593d7ae4a7ba731e5065793

URL: https://github.com/llvm/llvm-project/commit/4575f35ea15c71006593d7ae4a7ba731e5065793
DIFF: https://github.com/llvm/llvm-project/commit/4575f35ea15c71006593d7ae4a7ba731e5065793.diff

LOG: LocalStackSlotAllocation: Stop creating unused virtual register

Added: 
    

Modified: 
    llvm/lib/CodeGen/LocalStackSlotAllocation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp b/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
index 75c59d9b5814e..afebc17322472 100644
--- a/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
+++ b/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
@@ -344,7 +344,7 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) {
 
   MachineBasicBlock *Entry = &Fn.front();
 
-  unsigned BaseReg = 0;
+  Register BaseReg;
   int64_t BaseOffset = 0;
 
   // Loop through the frame references and allocate for them as necessary.
@@ -414,10 +414,6 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) {
         continue;
       }
 
-      const MachineFunction *MF = MI.getMF();
-      const TargetRegisterClass *RC = TRI->getPointerRegClass(*MF);
-      BaseReg = Fn.getRegInfo().createVirtualRegister(RC);
-
       LLVM_DEBUG(dbgs() << "  Materializing base register"
                         << " at frame local offset "
                         << LocalOffset + InstrOffset);
@@ -437,7 +433,7 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) {
       ++NumBaseRegisters;
       UsedBaseReg = true;
     }
-    assert(BaseReg != 0 && "Unable to allocate virtual base register!");
+    assert(BaseReg && "Unable to allocate virtual base register!");
 
     // Modify the instruction to use the new base register rather
     // than the frame index operand.


        


More information about the llvm-commits mailing list