[llvm] e110897 - [WEbAssembly] Clear frame base vreg in explicit-locals when stack pointer is dead

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 13:08:39 PDT 2020


Author: Derek Schuff
Date: 2020-03-26T13:07:32-07:00
New Revision: e110897e28c31f0241590a04e19814b5faeb5663

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

LOG: [WEbAssembly] Clear frame base vreg in explicit-locals when stack pointer is dead

Having an alloca in a function causes the stack pointer to be generated in the
prolog, but if it's unused other than for debug info, explicit-locals will drop
it and not allocate a local. In this case we need to reset the FrameBaseVreg.

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

Added: 
    

Modified: 
    llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
index 56da3ec11902..03b70f3a6a24 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
@@ -313,6 +313,8 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) {
                     .addReg(NewReg);
             // After the drop instruction, this reg operand will not be used
             Drop->getOperand(0).setIsKill();
+            if (MFI.isFrameBaseVirtual() && OldReg == MFI.getFrameBaseVreg())
+              MFI.clearFrameBaseVreg();
           } else {
             unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg);
             unsigned Opc = getLocalSetOpcode(RC);


        


More information about the llvm-commits mailing list