summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/AsmWriter.cpp10
-rw-r--r--llvm/test/ThinLTO/X86/distributed_indexes.ll6
2 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 736a836b490..9eaa29678e3 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -2788,8 +2788,14 @@ static const char *getSummaryKindName(GlobalValueSummary::SummaryKind SK) {
}
void AssemblyWriter::printAliasSummary(const AliasSummary *AS) {
- Out << ", aliasee: ^"
- << Machine.getGUIDSlot(SummaryToGUIDMap[&AS->getAliasee()]);
+ Out << ", aliasee: ";
+ // The indexes emitted for distributed backends may not include the
+ // aliasee summary (only if it is being imported directly). Handle
+ // that case by just emitting "null" as the aliasee.
+ if (AS->hasAliasee())
+ Out << "^" << Machine.getGUIDSlot(SummaryToGUIDMap[&AS->getAliasee()]);
+ else
+ Out << "null";
}
void AssemblyWriter::printGlobalVarSummary(const GlobalVarSummary *GS) {
diff --git a/llvm/test/ThinLTO/X86/distributed_indexes.ll b/llvm/test/ThinLTO/X86/distributed_indexes.ll
index bcde341bbac..371f38f5074 100644
--- a/llvm/test/ThinLTO/X86/distributed_indexes.ll
+++ b/llvm/test/ThinLTO/X86/distributed_indexes.ll
@@ -40,6 +40,12 @@
; BACKEND2-NEXT: <COMBINED_ALIAS
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
+; Make sure that when the alias is imported as a copy of the aliasee, but the
+; aliasee is not being imported by itself, that we can still print the summary.
+; The aliasee should be "null".
+; RUN: llvm-dis %t1.bc.thinlto.bc -o - | FileCheck %s --check-prefix=DIS
+; DIS: aliasee: null
+
declare void @g(...)
declare void @analias(...)
OpenPOWER on IntegriCloud