[PATCH] D40747: [ThinLTO] Enable importing of aliases as copy of aliasee

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 10:52:09 PST 2017


pcc added a comment.

In https://reviews.llvm.org/D40747#953993, @tejohnson wrote:

> In https://reviews.llvm.org/D40747#947144, @pcc wrote:
>
> > Now that we basically treat alias summaries in the same way as their aliasees, I wonder whether we can simplify things by removing AliasSummary and summarizing aliases by creating a FunctionSummary or GlobalVariableSummary from the aliasee instead.
>
>
> I'm not sure we can as there are other requirements for knowing the alias relationship. For example, we can't convert a non-prevailing alias and aliasee to available_externally (see thinLTOResolveWeakForLinkerGUID) - that is in the original module and not related to importing.


That could be resolved by adding a HasAlias flag to GlobalValueSummary, no? We would set it on aliases and anything that is aliased.

Sorry for the delay, I was working on prototyping my suggested change to make sure that it would work (and so far it looks like it would). This is probably fine for now though.



================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:127
+static cl::opt<bool>
+    ImportAllIndex("import-all-index",
+                   cl::desc("Import all external functions in index."));
----------------
I see why this is needed for now, but it seems like there is a possibility that we could make the distributed combined summary format simpler by not including a summary at all but just the names of the globals that need to be imported.


================
Comment at: test/ThinLTO/X86/funcimport.ll:21
+; a declaration
 ; non-imported function are correctly turned into declarations.
 ; Also ensures that alias to a linkonce function is turned into a declaration
----------------
I think you want to remove this line.


================
Comment at: test/Transforms/FunctionImport/funcimport.ll:39
 
-; Cannot create an alias to available_externally
-; CHECK-DAG: declare void @analias
+; External alias importes as available_externally copy of aliasee
+; CHECK-DAG: define available_externally void @analias
----------------
imported (same below)


https://reviews.llvm.org/D40747





More information about the llvm-commits mailing list