summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
diff options
context:
space:
mode:
authorNikola Prica <nikola.prica@rt-rk.com>2019-06-10 08:41:06 +0000
committerNikola Prica <nikola.prica@rt-rk.com>2019-06-10 08:41:06 +0000
commitabc1dff7e44a9eed6c2cc9a7d9ee366fbe4abcf7 (patch)
tree53da99a08fdde1c13ce220bc8ca0b9628a371507 /llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
parent44d908d743d2e42206a8884ab2dea35cd29bb2da (diff)
downloadbcm5719-llvm-abc1dff7e44a9eed6c2cc9a7d9ee366fbe4abcf7.tar.gz
bcm5719-llvm-abc1dff7e44a9eed6c2cc9a7d9ee366fbe4abcf7.zip
[DebugInfo] More strict debug range for stack variables
Variable's stack location can stretch longer than it should. If a variable is placed at the stack in a some nested basic block its range can be calculated to be up to the next occurrence of the variable's DBG_VALUE, or up to the end of the function, thus covering a basic blocks that should not be included in the variable’s location range. This happens because the DbgEntityHistoryCalculator ends register locations at the end of a basic block only if the variable’s location register has been changed throughout the function, which is not the case for the register used to reference stack objects. This patch also tries to produce a single value location if the location list builder managed to merge all the locations into one. Reviewers: aprantl, dstenb, jmorse Reviewed By: aprantl, dstenb, jmorse Subscribers: djtodoro, ivanbaev, asowda Tags: #debug-info Differential Revision: https://reviews.llvm.org/D61600 llvm-svn: 362923
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
index c006f3cc2ef..3bf25eb3619 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -287,6 +287,7 @@ void llvm::calculateDbgEntityHistory(const MachineFunction *MF,
const TargetLowering *TLI = MF->getSubtarget().getTargetLowering();
unsigned SP = TLI->getStackPointerRegisterToSaveRestore();
+ unsigned FrameReg = TRI->getFrameRegister(*MF);
RegDescribedVarsMap RegVars;
DbgValueEntriesMap LiveEntries;
for (const auto &MBB : *MF) {
@@ -359,7 +360,8 @@ void llvm::calculateDbgEntityHistory(const MachineFunction *MF,
for (auto I = RegVars.begin(), E = RegVars.end(); I != E;) {
auto CurElem = I++; // CurElem can be erased below.
if (TRI->isVirtualRegister(CurElem->first) ||
- ChangingRegs.test(CurElem->first))
+ ChangingRegs.test(CurElem->first) ||
+ CurElem->first == FrameReg)
clobberRegisterUses(RegVars, CurElem, DbgValues, LiveEntries,
MBB.back());
}
OpenPOWER on IntegriCloud