DebugInfo: Avoid re-looking up the DwarfUnit when emitting pubnames/pubtypes
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Mar 2014 23:23:39 +0000 (23:23 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Mar 2014 23:23:39 +0000 (23:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203620 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 93cd89e77a28897df38e2419be2ae659cf9e3e21..45a90dc12d7b61add8dfb3a8f0ec1e508520168e 100644 (file)
@@ -2212,6 +2212,9 @@ void DwarfDebug::emitDebugPubSection(
     const StringMap<const DIE *> &(DwarfUnit::*Accessor)() const) {
   for (const auto &NU : CUMap) {
     DwarfCompileUnit *TheU = NU.second;
+
+    const auto &Globals = (TheU->*Accessor)();
+
     if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
       TheU = Skeleton;
     unsigned ID = TheU->getUniqueID();
@@ -2237,7 +2240,7 @@ void DwarfDebug::emitDebugPubSection(
     Asm->EmitLabelDifference(TheU->getLabelEnd(), TheU->getLabelBegin(), 4);
 
     // Emit the pubnames for this compilation unit.
-    for (const auto &GI : (getUnits()[ID]->*Accessor)()) {
+    for (const auto &GI : Globals) {
       const char *Name = GI.getKeyData();
       const DIE *Entity = GI.second;