Temporarily revert r192749 as it is causing problems for LTO and
authorEric Christopher <echristo@gmail.com>
Fri, 18 Oct 2013 01:57:30 +0000 (01:57 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 18 Oct 2013 01:57:30 +0000 (01:57 +0000)
requires a more in depth change to the IR structure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192938 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 2e5205205d02130d44f8257288865abd5e23848d..755f27867ec229525a8311f80be1497859508930 100644 (file)
@@ -827,7 +827,14 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
 
 // Construct subprogram DIE.
 void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N) {
-  assert(!SPMap[N] && "Trying to create a subprogram DIE twice!");
+  // FIXME: We should only call this routine once, however, during LTO if a
+  // program is defined in multiple CUs we could end up calling it out of
+  // beginModule as we walk the CUs.
+
+  CompileUnit *&CURef = SPMap[N];
+  if (CURef)
+    return;
+  CURef = TheCU;
 
   DISubprogram SP(N);
   if (!SP.isDefinition())
@@ -836,7 +843,6 @@ void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N) {
     return;
 
   DIE *SubprogramDie = TheCU->getOrCreateSubprogramDIE(SP);
-  SPMap[N] = TheCU;
 
   // Expose as a global name.
   TheCU->addGlobalName(SP.getName(), SubprogramDie, resolve(SP.getContext()));