summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMikael Holmen <mikael.holmen@ericsson.com>2018-01-29 12:37:30 +0000
committerMikael Holmen <mikael.holmen@ericsson.com>2018-01-29 12:37:30 +0000
commita9e31537af5d70ad2d71b80a71ea42c89a7f2ba7 (patch)
tree3eb9869ef00c0e45ef8e3012a6c0b21da0363711 /llvm/lib/CodeGen
parent865de57bde1b3fa0184679c93ebb9127c3f0f1e1 (diff)
downloadbcm5719-llvm-a9e31537af5d70ad2d71b80a71ea42c89a7f2ba7.tar.gz
bcm5719-llvm-a9e31537af5d70ad2d71b80a71ea42c89a7f2ba7.zip
[DebugInfo] Fix fragment offset emission order for symbol locations
Summary: When emitting the location for a global variable with fragmented debug expressions, make sure that the offset pieces, which represent optimized-out parts of the variable, are emitted before their succeeding fragments' expressions. Previously, if the succeeding fragment's location was a symbol, the offset piece was emitted after, rather than before, that symbol's expression. This effectively meant that the symbols were associated with the wrong parts of the variable. This fixes PR36085. Patch by: David Stenberg Reviewers: aprantl, probinson, dblaikie Reviewed By: aprantl Subscribers: JDevlieghere, llvm-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D42527 llvm-svn: 323644
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index c009adc1e50..3cde5ad38ce 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -191,6 +191,9 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
DwarfExpr = llvm::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
}
+ if (Expr)
+ DwarfExpr->addFragmentOffset(Expr);
+
if (Global) {
const MCSymbol *Sym = Asm->getSymbol(Global);
if (Global->isThreadLocal()) {
@@ -226,10 +229,8 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
addOpAddress(*Loc, Sym);
}
}
- if (Expr) {
- DwarfExpr->addFragmentOffset(Expr);
+ if (Expr)
DwarfExpr->addExpression(Expr);
- }
}
if (Loc)
addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize());
OpenPOWER on IntegriCloud