// 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);
; 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
; 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
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
+}