[PATCH] D48699: [ThinLTO] Fix printing of aliases for distributed backend indexes

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 19:47:56 PDT 2018


tejohnson created this revision.
tejohnson added a reviewer: davidxl.
Herald added subscribers: steven_wu, eraman, inglorion, mehdi_amini.
Herald added a reviewer: dexonsmith.
Herald added a reviewer: dexonsmith.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D48699

Files:
  lib/IR/AsmWriter.cpp
  test/ThinLTO/X86/distributed_indexes.ll


Index: test/ThinLTO/X86/distributed_indexes.ll
===================================================================
--- test/ThinLTO/X86/distributed_indexes.ll
+++ 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(...)
 
Index: lib/IR/AsmWriter.cpp
===================================================================
--- lib/IR/AsmWriter.cpp
+++ lib/IR/AsmWriter.cpp
@@ -2788,8 +2788,14 @@
 }
 
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48699.153246.patch
Type: text/x-patch
Size: 1409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180628/e31441cc/attachment.bin>


More information about the llvm-commits mailing list