[PATCH] D51078: Reduce the memory footprint of dsymutil. (NFC)

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 19:29:09 PDT 2018


aprantl marked 3 inline comments as done.
aprantl added inline comments.


================
Comment at: tools/dsymutil/DwarfLinker.cpp:2468-2469
       }
-
-      if (!CUDie || LLVM_UNLIKELY(Options.Update) ||
-          !registerModuleReference(CUDie, *CU, ModuleMap, LinkContext.DMO,
-                                   LinkContext.Ranges, OffsetsStringPool,
-                                   UniquingStringPool, ODRContexts, UnitID)) {
-        LinkContext.CompileUnits.push_back(llvm::make_unique<CompileUnit>(
-            *CU, UnitID++, !Options.NoODR && !Options.Update, ""));
-      }
+      if (auto CUDie = CU->getUnitDIE(false))
+        registerModuleReference(CUDie, *CU, ModuleMap, LinkContext.DMO,
+                                LinkContext.Ranges, OffsetsStringPool,
----------------
friss wrote:
> You're changing the semantics here. registerModuleReference would not have been called in Update mode and now it will.
> 
> Also, why not simply `if (CUDie)`?
That doesn't really matter because they would have been resolved in the first pass, but I'm changing it anyway.


================
Comment at: tools/dsymutil/DwarfLinker.cpp:2471
+                                LinkContext.Ranges, OffsetsStringPool,
+                                UniquingStringPool, ODRContexts, UnitID);
     }
----------------
friss wrote:
> Here UnitID is always the same in this loop. Pretty sure that's bad.
UnitDie is an inout parameter, it is being incremented by `loadClangModule()` if it creates a new module.


https://reviews.llvm.org/D51078





More information about the llvm-commits mailing list