diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-03-03 01:08:25 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-03-03 01:08:25 +0000 |
commit | ea8880b81fb030cc50f003fcf7cd5727e47165fd (patch) | |
tree | 6153b17831dc6a6c65b5648035ce1467a2ea50a7 /llvm/lib/CodeGen/LiveDebugValues.cpp | |
parent | e78d131a8dbacdfa3d9e8c80f9c9bac15120da10 (diff) | |
download | bcm5719-llvm-ea8880b81fb030cc50f003fcf7cd5727e47165fd.tar.gz bcm5719-llvm-ea8880b81fb030cc50f003fcf7cd5727e47165fd.zip |
LiveDebugValues: Assume calls never clobber SP.
A call should never modify the stack pointer, but some backends are
not so sure about this and never list SP in the regmask. For the
purposes of LiveDebugValues we assume a call never clobbers SP. We
already have a similar workaround in DbgValueHistoryCalculator (which
we hopefully can retire soon).
This fixes the availabilty of local ASANified variables on AArch64.
rdar://problem/27757381
llvm-svn: 296847
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugValues.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp index 3e079d6774e..f956974b1aa 100644 --- a/llvm/lib/CodeGen/LiveDebugValues.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues.cpp @@ -373,8 +373,12 @@ void LiveDebugValues::transferRegisterDef(MachineInstr &MI, unsigned SP = TLI->getStackPointerRegisterToSaveRestore(); SparseBitVector<> KillSet; for (const MachineOperand &MO : MI.operands()) { + // Determine whether the operand is a register def. Assume that call + // instructions never clobber SP, because some backends (e.g., AArch64) + // never list SP in the regmask. if (MO.isReg() && MO.isDef() && MO.getReg() && - TRI->isPhysicalRegister(MO.getReg())) { + TRI->isPhysicalRegister(MO.getReg()) && + !(MI.isCall() && MO.getReg() == SP)) { // Remove ranges of all aliased registers. for (MCRegAliasIterator RAI(MO.getReg(), TRI, true); RAI.isValid(); ++RAI) for (unsigned ID : OpenRanges.getVarLocs()) |