summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-05-04 16:10:43 +0000
committerAdrian Prantl <aprantl@apple.com>2018-05-04 16:10:43 +0000
commit3edc63a579b462ad6ce0d82395042f0d7c7f28d6 (patch)
treeff99525333017debde229eede74d76ffdbb14ca8 /llvm/lib/CodeGen/AsmPrinter
parentedc7a8c1e5c04f5892f2c2f3c3a907576eec370b (diff)
downloadbcm5719-llvm-3edc63a579b462ad6ce0d82395042f0d7c7f28d6.tar.gz
bcm5719-llvm-3edc63a579b462ad6ce0d82395042f0d7c7f28d6.zip
DwarfCompileUnit: Fix another assertion failure on malformed input
that is not rejected by the Verifier. Thanks to Björn Pettersson for providing a reproducer! llvm-svn: 331535
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 4a5c7b324d6..32b6657c2fd 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -234,7 +234,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
// It would be better if this were unconditional, but malformed input that
// mixes non-fragments and fragments for the same variable is too expensive
// to detect in the verifier.
- if (!DwarfExpr->isMemoryLocation())
+ if (DwarfExpr->isUnknownLocation())
DwarfExpr->setMemoryLocationKind();
DwarfExpr->addExpression(Expr);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
index 7d6d45e64d6..952b0d99a95 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
@@ -212,6 +212,7 @@ public:
void addUnsignedConstant(const APInt &Value);
bool isMemoryLocation() const { return LocationKind == Memory; }
+ bool isUnknownLocation() const { return LocationKind == Unknown; }
/// Lock this down to become a memory location description.
void setMemoryLocationKind() {
OpenPOWER on IntegriCloud