summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-03-18 02:35:03 +0000
committerAdrian Prantl <aprantl@apple.com>2014-03-18 02:35:03 +0000
commit0aa1aa2e9dcc0112e8db5a7e3a123ddcbf03cc28 (patch)
tree7d336a08ef64336a04b5ad4a56ee9938778cc1ef /llvm/lib
parent1a1647cab6f583a15b902efb78639480509eb446 (diff)
downloadbcm5719-llvm-0aa1aa2e9dcc0112e8db5a7e3a123ddcbf03cc28.tar.gz
bcm5719-llvm-0aa1aa2e9dcc0112e8db5a7e3a123ddcbf03cc28.zip
DwarfDebug: Only unique retained types instead of all types.
This is a follow-up to r203983 based on feedback from dblaikie and mren (Thanks!) No functionality change. llvm-svn: 204107
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp5
2 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index ecd10460a59..87f1878e865 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -846,8 +846,13 @@ void DwarfDebug::beginModule() {
for (unsigned i = 0, e = EnumTypes.getNumElements(); i != e; ++i)
CU->getOrCreateTypeDIE(EnumTypes.getElement(i));
DIArray RetainedTypes = CUNode.getRetainedTypes();
- for (unsigned i = 0, e = RetainedTypes.getNumElements(); i != e; ++i)
- CU->getOrCreateTypeDIE(RetainedTypes.getElement(i));
+ for (unsigned i = 0, e = RetainedTypes.getNumElements(); i != e; ++i) {
+ DIType Ty(RetainedTypes.getElement(i));
+ // The retained types array by design contains pointers to
+ // MDNodes rather than DIRefs. Unique them here.
+ DIType UniqueTy(resolve(Ty.getRef()));
+ CU->getOrCreateTypeDIE(UniqueTy);
+ }
// Emit imported_modules last so that the relevant context is already
// available.
for (unsigned i = 0, e = ImportedEntities.getNumElements(); i != e; ++i)
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index a7b43d80328..be21d633e54 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -971,6 +971,8 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
DIType Ty(TyNode);
assert(Ty.isType());
+ assert(*&Ty == resolve(Ty.getRef()) &&
+ "type was not uniqued, possible ODR violation.");
// Construct the context before querying for the existence of the DIE in case
// such construction creates the DIE.
@@ -978,9 +980,6 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
DIE *ContextDIE = getOrCreateContextDIE(Context);
assert(ContextDIE);
- // Unique the type. This is a noop if the type has no unique identifier.
- Ty = DIType(resolve(Ty.getRef()));
-
DIE *TyDIE = getDIE(Ty);
if (TyDIE)
return TyDIE;
OpenPOWER on IntegriCloud