aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2020-03-25 10:35:12 -0700
committerDerek Schuff <dschuff@chromium.org>2020-03-26 13:07:32 -0700
commite110897e28c31f0241590a04e19814b5faeb5663 (patch)
tree9b8884b205810a6418de3369ecbf32ae49b88b68 /llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
parent39a52a19ed0206e0ebd1530f881f79a1511a2299 (diff)
downloadllvm-e110897e28c31f0241590a04e19814b5faeb5663.zip
llvm-e110897e28c31f0241590a04e19814b5faeb5663.tar.gz
llvm-e110897e28c31f0241590a04e19814b5faeb5663.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
index 56da3ec..03b70f3 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);