[PATCH] D38129: [ELF] - Speedup -r and --emit-relocs

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 10:54:54 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1364
+    for (const SymbolTableEntry &E : Symbols) {
+      if (E.Symbol->Type != STT_SECTION)
+        SymbolToIndexMap[E.Symbol] = ++I;
----------------
Flip the condition and swap `then` and `else`.


================
Comment at: ELF/SyntheticSections.cpp:1375-1380
+  if (Body->Type == STT_SECTION) {
+    auto I = SectionToIndexMap.find(Body->getOutputSection());
+    return (I != SectionToIndexMap.end()) ? I->second : 0;
+  }
+  auto I = SymbolToIndexMap.find(Body);
+  return (I != SymbolToIndexMap.end()) ? I->second : 0;
----------------
You should use `lookup` instead of `find`.


https://reviews.llvm.org/D38129





More information about the llvm-commits mailing list