diff options
| author | Adrian Prantl <aprantl@apple.com> | 2017-08-19 01:15:06 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2017-08-19 01:15:06 +0000 |
| commit | 2116dd360a3f118691c0383f1eef08ec8f4ae6d5 (patch) | |
| tree | 2aa6eb04b442a0f02d29ca59dfea7e1d08ee7d81 /llvm/lib/CodeGen | |
| parent | 0da12c841adee9718cd75e4ff4ddc37db89f6832 (diff) | |
| download | bcm5719-llvm-2116dd360a3f118691c0383f1eef08ec8f4ae6d5.tar.gz bcm5719-llvm-2116dd360a3f118691c0383f1eef08ec8f4ae6d5.zip | |
Filter out non-constant DIGlobalVariableExpressions reachable via the CU
They won't affect the DWARF output, but they will mess with the
sorting of the fragments. This fixes the crash reported in PR34159.
https://bugs.llvm.org/show_bug.cgi?id=34159
llvm-svn: 311217
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 21f632a9194..d724c9325e1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -592,8 +592,15 @@ void DwarfDebug::beginModule() { DwarfCompileUnit &CU = getOrCreateDwarfCompileUnit(CUNode); // Global Variables. - for (auto *GVE : CUNode->getGlobalVariables()) - GVMap[GVE->getVariable()].push_back({nullptr, GVE->getExpression()}); + for (auto *GVE : CUNode->getGlobalVariables()) { + // Don't bother adding DIGlobalVariableExpressions listed in the CU if we + // already know about the variable and it isn't adding a constant + // expression. + auto &GVMapEntry = GVMap[GVE->getVariable()]; + auto *Expr = GVE->getExpression(); + if (!GVMapEntry.size() || (Expr && Expr->isConstant())) + GVMapEntry.push_back({nullptr, Expr}); + } DenseSet<DIGlobalVariable *> Processed; for (auto *GVE : CUNode->getGlobalVariables()) { DIGlobalVariable *GV = GVE->getVariable(); |

