[PATCH] D156730: [LTO] Remove module id from summary index

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 20:03:01 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Sorry for the delay. Looks great!



================
Comment at: llvm/lib/IR/ModuleSummaryIndex.cpp:566
+  for (auto &ModPath : ModulePaths)
+    ModuleIdMap[ModPath] = ModuleIdMap.size();
+
----------------
There is a pitfall. `ModuleIdMap[ModPath]` increases the size while `ModuleIdMap.size();` changes the size, so the assignment behavior is dependent on the evaluation order. Suggest `try_emplace`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156730/new/

https://reviews.llvm.org/D156730



More information about the llvm-commits mailing list