[llvm] r336160 - [ThinLTO] Fix printing of aliases for distributed backend indexes
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 2 18:11:44 PDT 2018
Author: tejohnson
Date: Mon Jul 2 18:11:43 2018
New Revision: 336160
URL: http://llvm.org/viewvc/llvm-project?rev=336160&view=rev
Log:
[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
Modified:
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=336160&r1=336159&r2=336160&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Mon Jul 2 18:11:43 2018
@@ -2788,8 +2788,14 @@ static const char *getSummaryKindName(Gl
}
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) {
Modified: llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll?rev=336160&r1=336159&r2=336160&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll Mon Jul 2 18:11:43 2018
@@ -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(...)
More information about the llvm-commits
mailing list