[PATCH] D110296: [ThinLTO] Don't emit original GUID for locals to distributed indexes

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 17:36:08 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c1defeee40c: [ThinLTO] Don't emit original GUID for locals to distributed indexes (authored by tejohnson).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110296

Files:
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/test/ThinLTO/X86/distributed_indexes.ll


Index: llvm/test/ThinLTO/X86/distributed_indexes.ll
===================================================================
--- llvm/test/ThinLTO/X86/distributed_indexes.ll
+++ llvm/test/ThinLTO/X86/distributed_indexes.ll
@@ -20,10 +20,12 @@
 ; BACKEND1-DAG: <VALUE_GUID op0={{.*}} op1=-5300342847281564238
 ; BACKEND1-DAG: <VALUE_GUID op0={{.*}} op1=-3706093650706652785
 ; BACKEND1-DAG: <VALUE_GUID op0={{.*}} op1=-1039159065113703048
-; BACKEND1-DAG: <COMBINED {{.*}} op1=0
-; BACKEND1-DAG: <COMBINED {{.*}} op1=1
-; BACKEND1-DAG: <COMBINED_ALIAS {{.*}} op1=1
-; BACKEND1-NEXT: <BLOCK_COUNT op0=3/>
+; BACKEND1-DAG: <VALUE_GUID op0={{.*}} op1=-126160295109682753
+; BACKEND1-NEXT: <COMBINED {{.*}} op1=0
+; BACKEND1-NEXT: <COMBINED {{.*}} op1=0
+; BACKEND1-NEXT: <COMBINED {{.*}} op1=1
+; BACKEND1-NEXT: <COMBINED_ALIAS {{.*}} op1=1
+; BACKEND1-NEXT: <BLOCK_COUNT op0=4/>
 ; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK
 
 ; The backend index for Input/distributed_indexes.ll contains summaries from
@@ -39,7 +41,7 @@
 ; BACKEND2-NEXT: <COMBINED
 ; BACKEND2-NEXT: <COMBINED
 ; BACKEND2-NEXT: <COMBINED_ALIAS
-; BACKEND2-NEXT: <BLOCK_COUNT op0=3/>
+; BACKEND2-NEXT: <BLOCK_COUNT op0=4/>
 ; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
 
 ; Make sure that when the alias is imported as a copy of the aliasee, but the
@@ -59,3 +61,9 @@
   call void (...) @analias()
   ret void
 }
+
+; Ensure we don't get a COMBINED_ORIGINAL_NAME record in the distributed index.
+; The BACKEND1-NEXT checks would fail if we did.
+define internal void @x() {
+  ret void
+}
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4148,7 +4148,14 @@
   // For local linkage, we also emit the original name separately
   // immediately after the record.
   auto MaybeEmitOriginalName = [&](GlobalValueSummary &S) {
-    if (!GlobalValue::isLocalLinkage(S.linkage()))
+    // We don't need to emit the original name if we are writing the index for
+    // distributed backends (in which case ModuleToSummariesForIndex is
+    // non-null). The original name is only needed during the thin link, since
+    // for SamplePGO the indirect call targets for local functions have
+    // have the original name annotated in profile.
+    // Continue to emit it when writing out the entire combined index, which is
+    // used in testing the thin link via llvm-lto.
+    if (ModuleToSummariesForIndex || !GlobalValue::isLocalLinkage(S.linkage()))
       return;
     NameVals.push_back(S.getOriginalName());
     Stream.EmitRecord(bitc::FS_COMBINED_ORIGINAL_NAME, NameVals);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110296.374702.patch
Type: text/x-patch
Size: 2695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210924/cd50849c/attachment.bin>


More information about the llvm-commits mailing list