summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-03-23 23:35:00 +0000
committerAdrian Prantl <aprantl@apple.com>2017-03-23 23:35:00 +0000
commitf0ffc5233d7042aa426e2305a64e6a09ba4e6c8a (patch)
tree1cbbe72be57c6287661752ec8a25c4ce64fe796c /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parent11873949e0c418c1e72730e5a41dd32e7cf04b80 (diff)
downloadbcm5719-llvm-f0ffc5233d7042aa426e2305a64e6a09ba4e6c8a.tar.gz
bcm5719-llvm-f0ffc5233d7042aa426e2305a64e6a09ba4e6c8a.zip
Fix a bug when emitting debug info for partially constant global variables.
While fixing a malformed testcase, I discovered that the code exercised by it was wrong, too. llvm-svn: 298664
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 60973f33af5..40712463590 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -142,12 +142,6 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
bool addToAccelTable = false;
DIELoc *Loc = nullptr;
std::unique_ptr<DIEDwarfExpression> DwarfExpr;
- bool AllConstant = std::all_of(
- GlobalExprs.begin(), GlobalExprs.end(),
- [&](const GlobalExpr GE) {
- return GE.Expr && GE.Expr->isConstant();
- });
-
for (const auto &GE : GlobalExprs) {
const GlobalVariable *Global = GE.Var;
const DIExpression *Expr = GE.Expr;
@@ -158,7 +152,8 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
addConstantValue(*VariableDIE, /*Unsigned=*/true, Expr->getElement(1));
// We cannot describe the location of dllimport'd variables: the
// computation of their address requires loads from the IAT.
- } else if ((Global && !Global->hasDLLImportStorageClass()) || AllConstant) {
+ } else if ((Global && !Global->hasDLLImportStorageClass()) ||
+ (Expr && Expr->isConstant())) {
if (!Loc) {
Loc = new (DIEValueAllocator) DIELoc;
DwarfExpr = llvm::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
OpenPOWER on IntegriCloud