[PATCH] D56953: [COFF] Limit PR39667 ICF partitioning changes to ARM64

David Major via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 18:01:20 PST 2019


dmajor created this revision.
dmajor added reviewers: pcc, ruiu, rnk.
Herald added subscribers: llvm-commits, kristof.beyls, javed.absar.

While the changes in rL347429 <https://reviews.llvm.org/rL347429> brought dramatic improvements to Firefox link time on ARM64, they also caused large regressions in link time on x86_64 PGO builds, severe enough that we had to back out our clang roll. I assume the slowdown has something to do with the sections created for profiling instrumentation. (It would be interesting to see what effect that patch had on ARM64 PGO builds, but we don't have such a thing yet.)

As a starting point, here's a patch to restrict rL347429 <https://reviews.llvm.org/rL347429> to ARM64 only. (And, if accepted, I'd suggest merging it to to 8.0.0.) Being unfamiliar with this code, I can't tell if this is a proper solution or a hack, so I'll rely on reviewers to let me know.

I don't know what to do about the corresponding ELF changes in D54773 <https://reviews.llvm.org/D54773>/rLLD347594 <https://reviews.llvm.org/rLLD347594>. I'm not even sure if the regression occurs on ELF platforms.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56953

Files:
  COFF/ICF.cpp


Index: COFF/ICF.cpp
===================================================================
--- COFF/ICF.cpp
+++ COFF/ICF.cpp
@@ -267,12 +267,14 @@
   });
 
   // Combine the hashes of the sections referenced by each section into its
-  // hash.
+  // hash. This is only needed for ARM64, where the .pdata format makes those
+  // sections less likely to be unique.
   parallelForEach(Chunks, [&](SectionChunk *SC) {
     uint32_t Hash = SC->Class[1];
-    for (Symbol *B : SC->symbols())
-      if (auto *Sym = dyn_cast_or_null<DefinedRegular>(B))
-        Hash ^= Sym->getChunk()->Class[1];
+    if (Config->Machine == ARM64)
+      for (Symbol *B : SC->symbols())
+        if (auto *Sym = dyn_cast_or_null<DefinedRegular>(B))
+          Hash ^= Sym->getChunk()->Class[1];
     // Set MSB to 1 to avoid collisions with non-hash classs.
     SC->Class[0] = Hash | (1U << 31);
   });


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56953.182655.patch
Type: text/x-patch
Size: 880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190119/7a60b8c9/attachment-0001.bin>


More information about the llvm-commits mailing list