[PATCH] D48698: [ThinLTO] Fix printing of module paths for distributed backend indexes

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 13:42:37 PDT 2018


tejohnson marked an inline comment as done.
tejohnson added inline comments.


================
Comment at: lib/IR/AsmWriter.cpp:1019
+    ModuleIdToPathMap[ModPath.second.first] = ModPath.first();
+  for (auto &ModPair : ModuleIdToPathMap)
+    CreateModulePathSlot(ModPair.second);
----------------
davidxl wrote:
> Can these two loops be fused ?
No, there are 2 loops for the reason noted in the comments: Since the StringMap iteration order isn't
  // guaranteed, use a std::map to order by module ID before assigning slots.


================
Comment at: lib/IR/AsmWriter.cpp:1119
+  // Check for uninitialized state and do lazy initialization.
+  initializeIndex();
+
----------------
davidxl wrote:
> probably better to rename the function as initializeIndexIfNeeded or something, but can be done separately.
Will do as a follow-on (I named this similar to the existing "initialize()" which does lazy initialization of slots needed for printing the Module.


Repository:
  rL LLVM

https://reviews.llvm.org/D48698





More information about the llvm-commits mailing list