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

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 18:16:41 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL336160: [ThinLTO] Fix printing of aliases for distributed backend indexes (authored by tejohnson, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48699

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


Index: llvm/trunk/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp
+++ llvm/trunk/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) {
Index: llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll
===================================================================
--- llvm/trunk/test/ThinLTO/X86/distributed_indexes.ll
+++ llvm/trunk/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(...)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48699.153838.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180703/429605a5/attachment.bin>


More information about the llvm-commits mailing list