From: Teresa Johnson Date: Sun, 27 Mar 2016 15:01:11 +0000 (+0000) Subject: [ThinLTO] Don't try to import alias unless aliasee can be imported X-Git-Tag: llvmorg-3.9.0-rc1~10803 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9aae395fa809aa07dcceafc2552cca45205c43bd;p=platform%2Fupstream%2Fllvm.git [ThinLTO] Don't try to import alias unless aliasee can be imported With r264503, aliases are now being added to the GlobalsToImport set even when their aliasees can't be imported due to their linkage type. While the importing worked correctly (the aliases imported as declarations) due to the logic in doImportAsDefinition, there is no point to adding them to the GlobalsToImport set. Additionally, with D18487 it was resulting in incorrectly printing a message indicating that the alias was imported. To avoid this, delay adding aliases to the GlobalsToImport set until after the linkage type of the aliasee is checked. This patch is part of D18487. llvm-svn: 264536 --- diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 5bd2539..896ac5d 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -322,14 +322,14 @@ bool FunctionImporter::importFunctions( continue; auto GUID = GV.getGUID(); if (ImportGUIDs.count(GUID)) { - GV.materialize(); - GlobalsToImport.insert(&GV); // Alias can't point to "available_externally". However when we import - // linkOnceODR the linkage does not change. So we import the aliasee - // only in this case + // linkOnceODR the linkage does not change. So we import the alias + // and aliasee only in this case. const GlobalObject *GO = GV.getBaseObject(); if (!GO->hasLinkOnceODRLinkage()) continue; + GV.materialize(); + GlobalsToImport.insert(&GV); GlobalsToImport.insert(GO); } }