summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2018-07-03 01:11:43 +0000
committerTeresa Johnson <tejohnson@google.com>2018-07-03 01:11:43 +0000
commitf8182f1aef5b6ec74cbe2c1618e759f0113921ba (patch)
tree6a4ae9ee8bdce21c3601326b6cb205525e6a910a
parent0409a8ade790db39634701c46e6eb31f8a923b2e (diff)
downloadbcm5719-llvm-f8182f1aef5b6ec74cbe2c1618e759f0113921ba.tar.gz
bcm5719-llvm-f8182f1aef5b6ec74cbe2c1618e759f0113921ba.zip
[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
-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