From f8182f1aef5b6ec74cbe2c1618e759f0113921ba Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Tue, 3 Jul 2018 01:11:43 +0000 Subject: [ThinLTO] Fix printing of aliases for distributed backend indexes Summary: When we import an alias (which will import a copy of the aliasee), but aren't going to import the aliasee directly, the distributed backend index will not contain the aliasee summary. Handle this in the summary assembly printer by printing "null" as the aliasee. Reviewers: davidxl, dexonsmith Subscribers: mehdi_amini, inglorion, eraman, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D48699 llvm-svn: 336160 --- llvm/lib/IR/AsmWriter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'llvm/lib/IR/AsmWriter.cpp') 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) { -- cgit v1.2.3