<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks for looking! Sorry about the noise. I will keep an eye on the bot.<div class=""><br class=""></div><div class="">Steven</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2016, at 2:32 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Saw this in another bot confirmed it was fixed by r270600. Please let me know if that doesn't fix it!<div class="">Thanks,</div><div class="">Teresa </div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 24, 2016 at 2:29 PM, Steven Wu <span dir="ltr" class=""><<a href="mailto:stevenwu@apple.com" target="_blank" class="">stevenwu@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Teresa<br class="">
<br class="">
This commit seems cause bot failure: <a href="http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/7989/" rel="noreferrer" target="_blank" class="">http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/7989/</a><br class="">
<br class="">
You should be able to see failure if you run ASAN with the test (I am running on my own branch so the line number might not match).<br class="">
==65822==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000012 (pc 0x00010f73d69d bp 0x7fff52667270 sp 0x7fff52667250 T0)<br class="">
==65822==The signal is caused by a READ memory access.<br class="">
==65822==Hint: address points to the zero page.<br class="">
    #0 0x10f73d69c in std::__1::__function::__func<(anonymous namespace)::resolveWeakForLinkerInIndex(llvm::ModuleSummaryIndex&, llvm::StringMap<std::__1::unordered_set<unsigned long long, std::__1::hash<unsigned long long>, std::__1::equal_to<unsigned long long>, std::__1::allocator<unsigned long long> >, llvm::MallocAllocator> const&, llvm::DenseSet<unsigned long long, llvm::DenseMapInfo<unsigned long long> > const&, llvm::StringMap<std::__1::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::__1::less<unsigned long long>, std::__1::allocator<std::__1::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > >, llvm::MallocAllocator>&)::$_10, std::__1::allocator<(anonymous namespace)::resolveWeakForLinkerInIndex(llvm::ModuleSummaryIndex&, llvm::StringMap<std::__1::unordered_set<unsigned long long, std::__1::hash<unsigned long long>, std::__1::equal_to<unsigned long long>, std::__1::allocator<unsigned long long> >, llvm::MallocAllocator> const&, llvm::DenseSet<unsigned long long, llvm::DenseMapInfo<unsigned long long> > const&, llvm::StringMap<std::__1::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::__1::less<unsigned long long>, std::__1::allocator<std::__1::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > >, llvm::MallocAllocator>&)::$_10>, bool (llvm::StringRef, unsigned long long)>::operator()(llvm::StringRef&&, unsigned long long&&) __hash_table:836<br class="">
    #1 0x10f732c7e in (anonymous namespace)::resolveWeakForLinkerInIndex(llvm::ModuleSummaryIndex&, llvm::StringMap<std::__1::unordered_set<unsigned long long, std::__1::hash<unsigned long long>, std::__1::equal_to<unsigned long long>, std::__1::allocator<unsigned long long> >, llvm::MallocAllocator> const&, llvm::DenseSet<unsigned long long, llvm::DenseMapInfo<unsigned long long> > const&, llvm::StringMap<std::__1::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::__1::less<unsigned long long>, std::__1::allocator<std::__1::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > >, llvm::MallocAllocator>&) functional:1896<br class="">
    #2 0x10f730cea in llvm::ThinLTOCodeGenerator::promote(llvm::Module&, llvm::ModuleSummaryIndex&) ThinLTOCodeGenerator.cpp:720<br class="">
    #3 0x10d5b7237 in thinlto::ThinLTOProcessing::promote() llvm-lto.cpp:525<br class="">
    #4 0x10d59eb46 in main llvm-lto.cpp:721<br class="">
    #5 0x7fff8b9445ac in start (libdyld.dylib+0x35ac)<br class="">
    #6 0x6  (<unknown module>)<br class="">
<br class="">
Thanks<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
Steven<br class="">
</font></span><div class="HOEnZb"><div class="h5"><br class="">
<br class="">
> On May 24, 2016, at 10:24 AM, Teresa Johnson via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class="">
><br class="">
> Author: tejohnson<br class="">
> Date: Tue May 24 12:24:25 2016<br class="">
> New Revision: 270584<br class="">
><br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=270584&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=270584&view=rev</a><br class="">
> Log:<br class="">
> [ThinLTO] Change ODR resolution and internalization to be index-based<br class="">
><br class="">
> Summary:<br class="">
> This patch changes the ODR resolution and internalization to be based on<br class="">
> updates to the Index, which are consumed by the backend portion of the<br class="">
> transformations.<br class="">
><br class="">
> It will be followed by an NFC change to move these out of libLTO's<br class="">
> ThinLTOCodeGenerator so that it can be used by other linkers<br class="">
> (gold and lld) and by ThinLTO distributed backends.<br class="">
><br class="">
> The global summary-based portions use callbacks so that the client can<br class="">
> determine the prevailing copy and other information in a client-specific<br class="">
> way. Eventually, with the API being developed in D20268, these may be<br class="">
> modified to use information such as symbol resolutions, supplied by the<br class="">
> clients to the API.<br class="">
><br class="">
> Reviewers: joker-eph<br class="">
><br class="">
> Subscribers: joker.eph, pcc, llvm-commits<br class="">
><br class="">
> Differential Revision: <a href="http://reviews.llvm.org/D20290" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D20290</a><br class="">
><br class="">
> Modified:<br class="">
>    llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h<br class="">
>    llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h<br class="">
>    llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp<br class="">
><br class="">
> Modified: llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h?rev=270584&r1=270583&r2=270584&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h?rev=270584&r1=270583&r2=270584&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h (original)<br class="">
> +++ llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h Tue May 24 12:24:25 2016<br class="">
> @@ -168,6 +168,12 @@ public:<br class="">
>     return static_cast<GlobalValue::LinkageTypes>(Flags.Linkage);<br class="">
>   }<br class="">
><br class="">
> +  /// Sets the linkage to the value determined by global summary-based<br class="">
> +  /// optimization. Will be applied in the ThinLTO backends.<br class="">
> +  void setLinkage(GlobalValue::LinkageTypes Linkage) {<br class="">
> +    Flags.Linkage = Linkage;<br class="">
> +  }<br class="">
> +<br class="">
>   /// Return true if this summary is for a GlobalValue that needs promotion<br class="">
>   /// to be referenced from another module.<br class="">
>   bool needsRenaming() const { return GlobalValue::isLocalLinkage(linkage()); }<br class="">
> @@ -446,6 +452,13 @@ public:<br class="">
>     return NewName.str();<br class="">
>   }<br class="">
><br class="">
> +  /// Helper to obtain the unpromoted name for a global value (or the original<br class="">
> +  /// name if not promoted).<br class="">
> +  static StringRef getOriginalNameBeforePromote(StringRef Name) {<br class="">
> +    std::pair<StringRef, StringRef> Pair = Name.split(".llvm.");<br class="">
> +    return Pair.first;<br class="">
> +  }<br class="">
> +<br class="">
>   /// Add a new module path with the given \p Hash, mapped to the given \p<br class="">
>   /// ModID, and return an iterator to the entry in the index.<br class="">
>   ModulePathStringTableTy::iterator<br class="">
><br class="">
> Modified: llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h?rev=270584&r1=270583&r2=270584&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h?rev=270584&r1=270583&r2=270584&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h (original)<br class="">
> +++ llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h Tue May 24 12:24:25 2016<br class="">
> @@ -198,7 +198,9 @@ public:<br class="">
>   std::unique_ptr<ModuleSummaryIndex> linkCombinedIndex();<br class="">
><br class="">
>   /**<br class="">
> -   * Perform promotion and renaming of exported internal functions.<br class="">
> +   * Perform promotion and renaming of exported internal functions,<br class="">
> +   * and additionally resolve weak and linkonce symbols.<br class="">
> +   * Index is updated to reflect linkage changes from weak resolution.<br class="">
>    */<br class="">
>   void promote(Module &Module, ModuleSummaryIndex &Index);<br class="">
><br class="">
> @@ -222,7 +224,7 @@ public:<br class="">
>       std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);<br class="">
><br class="">
>   /**<br class="">
> -   * Perform internalization.<br class="">
> +   * Perform internalization. Index is updated to reflect linkage changes.<br class="">
>    */<br class="">
>   void internalize(Module &Module, ModuleSummaryIndex &Index);<br class="">
><br class="">
><br class="">
> Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=270584&r1=270583&r2=270584&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=270584&r1=270583&r2=270584&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)<br class="">
> +++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Tue May 24 12:24:25 2016<br class="">
> @@ -37,7 +37,6 @@<br class="">
> #include "llvm/MC/SubtargetFeature.h"<br class="">
> #include "llvm/Object/IRObjectFile.h"<br class="">
> #include "llvm/Object/ModuleSummaryIndexObjectFile.h"<br class="">
> -#include "llvm/Support/Debug.h"<br class="">
> #include "llvm/Support/CachePruning.h"<br class="">
> #include "llvm/Support/Debug.h"<br class="">
> #include "llvm/Support/Path.h"<br class="">
> @@ -89,9 +88,17 @@ static void saveTempBitcode(const Module<br class="">
>   WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true);<br class="">
> }<br class="">
><br class="">
> -bool IsFirstDefinitionForLinker(const GlobalValueSummaryList &GVSummaryList,<br class="">
> -                                const ModuleSummaryIndex &Index,<br class="">
> -                                StringRef ModulePath) {<br class="">
> +static const GlobalValueSummary *<br class="">
> +getFirstDefinitionForLinker(const GlobalValueSummaryList &GVSummaryList) {<br class="">
> +  // If there is any strong definition anywhere, get it.<br class="">
> +  auto StrongDefForLinker = llvm::find_if(<br class="">
> +      GVSummaryList, [](const std::unique_ptr<GlobalValueSummary> &Summary) {<br class="">
> +        auto Linkage = Summary->linkage();<br class="">
> +        return !GlobalValue::isAvailableExternallyLinkage(Linkage) &&<br class="">
> +               !GlobalValue::isWeakForLinker(Linkage);<br class="">
> +      });<br class="">
> +  if (StrongDefForLinker != GVSummaryList.end())<br class="">
> +    return StrongDefForLinker->get();<br class="">
>   // Get the first *linker visible* definition for this global in the summary<br class="">
>   // list.<br class="">
>   auto FirstDefForLinker = llvm::find_if(<br class="">
> @@ -99,78 +106,89 @@ bool IsFirstDefinitionForLinker(const Gl<br class="">
>         auto Linkage = Summary->linkage();<br class="">
>         return !GlobalValue::isAvailableExternallyLinkage(Linkage);<br class="">
>       });<br class="">
> -  // If \p GV is not the first definition, give up...<br class="">
> -  if ((*FirstDefForLinker)->modulePath() != ModulePath)<br class="">
> -    return false;<br class="">
> -  // If there is any strong definition anywhere, do not bother emitting this.<br class="">
> -  if (llvm::any_of(<br class="">
> -          GVSummaryList,<br class="">
> -          [](const std::unique_ptr<GlobalValueSummary> &Summary) {<br class="">
> -            auto Linkage = Summary->linkage();<br class="">
> -            return !GlobalValue::isAvailableExternallyLinkage(Linkage) &&<br class="">
> -                   !GlobalValue::isWeakForLinker(Linkage);<br class="">
> -          }))<br class="">
> -    return false;<br class="">
> -  return true;<br class="">
> -}<br class="">
> -<br class="">
> -static GlobalValue::LinkageTypes<br class="">
> -ResolveODR(const ModuleSummaryIndex &Index,<br class="">
> -           const FunctionImporter::ExportSetTy &ExportList,<br class="">
> -           const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> -           StringRef ModuleIdentifier, GlobalValue::GUID GUID,<br class="">
> -           const GlobalValueSummary &GV) {<br class="">
> +  // Extern templates can be emitted as available_externally.<br class="">
> +  if (FirstDefForLinker == GVSummaryList.end())<br class="">
> +    return nullptr;<br class="">
> +  return FirstDefForLinker->get();<br class="">
> +}<br class="">
> +<br class="">
> +// Populate map of GUID to the prevailing copy for any multiply defined<br class="">
> +// symbols. Currently assume first copy is prevailing, or any strong<br class="">
> +// definition. Can be refined with Linker information in the future.<br class="">
> +static void computePrevailingCopies(<br class="">
> +    const ModuleSummaryIndex &Index,<br class="">
> +    DenseMap<GlobalValue::GUID, const GlobalValueSummary *> &PrevailingCopy) {<br class="">
>   auto HasMultipleCopies = [&](const GlobalValueSummaryList &GVSummaryList) {<br class="">
>     return GVSummaryList.size() > 1;<br class="">
>   };<br class="">
><br class="">
> -  auto OriginalLinkage = GV.linkage();<br class="">
> -  switch (OriginalLinkage) {<br class="">
> -  case GlobalValue::ExternalLinkage:<br class="">
> -  case GlobalValue::AvailableExternallyLinkage:<br class="">
> -  case GlobalValue::AppendingLinkage:<br class="">
> -  case GlobalValue::InternalLinkage:<br class="">
> -  case GlobalValue::PrivateLinkage:<br class="">
> -  case GlobalValue::ExternalWeakLinkage:<br class="">
> -  case GlobalValue::CommonLinkage:<br class="">
> -  case GlobalValue::LinkOnceAnyLinkage:<br class="">
> -  case GlobalValue::WeakAnyLinkage:<br class="">
> -    break;<br class="">
> -  case GlobalValue::LinkOnceODRLinkage:<br class="">
> -  case GlobalValue::WeakODRLinkage: {<br class="">
> -    auto &GVSummaryList = Index.findGlobalValueSummaryList(GUID)->second;<br class="">
> -    // We need to emit only one of these, the first module will keep<br class="">
> -    // it, but turned into a weak while the others will drop it.<br class="">
> -    if (!HasMultipleCopies(GVSummaryList)) {<br class="">
> -      // Exported LinkonceODR needs to be promoted to not be discarded<br class="">
> -      if (GlobalValue::isDiscardableIfUnused(OriginalLinkage) &&<br class="">
> -          (ExportList.count(GUID) || GUIDPreservedSymbols.count(GUID)))<br class="">
> -        return GlobalValue::WeakODRLinkage;<br class="">
> -      break;<br class="">
> -    }<br class="">
> -    if (IsFirstDefinitionForLinker(GVSummaryList, Index, ModuleIdentifier))<br class="">
> -      return GlobalValue::WeakODRLinkage;<br class="">
> -    else if (isa<AliasSummary>(&GV))<br class="">
> -      // Alias can't be turned into available_externally.<br class="">
> -      return OriginalLinkage;<br class="">
> -    return GlobalValue::AvailableExternallyLinkage;<br class="">
> -  }<br class="">
> -  }<br class="">
> -  return OriginalLinkage;<br class="">
> -}<br class="">
> -<br class="">
> -/// Resolve LinkOnceODR and WeakODR.<br class="">
> -///<br class="">
> -/// We'd like to drop these function if they are no longer referenced in the<br class="">
> -/// current module. However there is a chance that another module is still<br class="">
> -/// referencing them because of the import. We make sure we always emit at least<br class="">
> -/// one copy.<br class="">
> -static void ResolveODR(<br class="">
> -    const ModuleSummaryIndex &Index,<br class="">
> -    const FunctionImporter::ExportSetTy &ExportList,<br class="">
> -    const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> -    const GVSummaryMapTy &DefinedGlobals, StringRef ModuleIdentifier,<br class="">
> -    std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR) {<br class="">
> +  for (auto &I : Index) {<br class="">
> +    if (HasMultipleCopies(I.second))<br class="">
> +      PrevailingCopy[I.first] = getFirstDefinitionForLinker(I.second);<br class="">
> +  }<br class="">
> +}<br class="">
> +<br class="">
> +static void thinLTOResolveWeakForLinkerGUID(<br class="">
> +    GlobalValueSummaryList &GVSummaryList, GlobalValue::GUID GUID,<br class="">
> +    DenseSet<GlobalValueSummary *> &GlobalInvolvedWithAlias,<br class="">
> +    std::function<bool(GlobalValue::GUID, const GlobalValueSummary *)><br class="">
> +        isPrevailing,<br class="">
> +    std::function<bool(StringRef, GlobalValue::GUID)> isExported,<br class="">
> +    std::function<void(StringRef, GlobalValue::GUID, GlobalValue::LinkageTypes)><br class="">
> +        recordNewLinkage) {<br class="">
> +  auto HasMultipleCopies = GVSummaryList.size() > 1;<br class="">
> +<br class="">
> +  for (auto &S : GVSummaryList) {<br class="">
> +    if (GlobalInvolvedWithAlias.count(S.get()))<br class="">
> +      continue;<br class="">
> +    GlobalValue::LinkageTypes OriginalLinkage = S->linkage();<br class="">
> +    if (!GlobalValue::isWeakForLinker(OriginalLinkage))<br class="">
> +      continue;<br class="">
> +    // We need to emit only one of these, the first module will keep it,<br class="">
> +    // but turned into a weak, while the others will drop it when possible.<br class="">
> +    if (!HasMultipleCopies) {<br class="">
> +      // Exported Linkonce needs to be promoted to not be discarded.<br class="">
> +      // FIXME: This should handle LinkOnceAny as well, but that should be a<br class="">
> +      // follow-on to the NFC restructuring:<br class="">
> +      // if (GlobalValue::isLinkOnceLinkage(OriginalLinkage) &&<br class="">
> +      //     isExported(S->modulePath(), GUID))<br class="">
> +      //   S->setLinkage(GlobalValue::getWeakLinkage(<br class="">
> +      //       GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)));<br class="">
> +      if (GlobalValue::isLinkOnceODRLinkage(OriginalLinkage) &&<br class="">
> +          isExported(S->modulePath(), GUID))<br class="">
> +        S->setLinkage(GlobalValue::WeakODRLinkage);<br class="">
> +    } else if (isPrevailing(GUID, S.get())) {<br class="">
> +      // FIXME: This should handle LinkOnceAny as well, but that should be a<br class="">
> +      // follow-on to the NFC restructuring:<br class="">
> +      // if (GlobalValue::isLinkOnceLinkage(OriginalLinkage))<br class="">
> +      //   S->setLinkage(GlobalValue::getWeakLinkage(<br class="">
> +      //       GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)));<br class="">
> +      if (GlobalValue::isLinkOnceODRLinkage(OriginalLinkage))<br class="">
> +        S->setLinkage(GlobalValue::WeakODRLinkage);<br class="">
> +    }<br class="">
> +    // Alias can't be turned into available_externally.<br class="">
> +    else if (!isa<AliasSummary>(S.get()) &&<br class="">
> +             (GlobalValue::isLinkOnceODRLinkage(OriginalLinkage) ||<br class="">
> +              GlobalValue::isWeakODRLinkage(OriginalLinkage)))<br class="">
> +      S->setLinkage(GlobalValue::AvailableExternallyLinkage);<br class="">
> +    if (S->linkage() != OriginalLinkage)<br class="">
> +      recordNewLinkage(S->modulePath(), GUID, S->linkage());<br class="">
> +  }<br class="">
> +}<br class="">
> +<br class="">
> +// Resolve Weak and LinkOnce values in the \p Index.<br class="">
> +//<br class="">
> +// We'd like to drop these functions if they are no longer referenced in the<br class="">
> +// current module. However there is a chance that another module is still<br class="">
> +// referencing them because of the import. We make sure we always emit at least<br class="">
> +// one copy.<br class="">
> +void thinLTOResolveWeakForLinkerInIndex(<br class="">
> +    ModuleSummaryIndex &Index,<br class="">
> +    std::function<bool(GlobalValue::GUID, const GlobalValueSummary *)><br class="">
> +        isPrevailing,<br class="">
> +    std::function<bool(StringRef, GlobalValue::GUID)> isExported,<br class="">
> +    std::function<void(StringRef, GlobalValue::GUID, GlobalValue::LinkageTypes)><br class="">
> +        recordNewLinkage) {<br class="">
>   if (Index.modulePaths().size() == 1)<br class="">
>     // Nothing to do if we don't have multiple modules<br class="">
>     return;<br class="">
> @@ -179,51 +197,41 @@ static void ResolveODR(<br class="">
>   // Ideally we should turn the alias into a global and duplicate the definition<br class="">
>   // when needed.<br class="">
>   DenseSet<GlobalValueSummary *> GlobalInvolvedWithAlias;<br class="">
> -  for (auto &GA : DefinedGlobals) {<br class="">
> -    if (auto AS = dyn_cast<AliasSummary>(GA.second))<br class="">
> -      GlobalInvolvedWithAlias.insert(&AS->getAliasee());<br class="">
> -  }<br class="">
> -<br class="">
> -  for (auto &GV : DefinedGlobals) {<br class="">
> -    if (GlobalInvolvedWithAlias.count(GV.second))<br class="">
> -      continue;<br class="">
> -    auto NewLinkage =<br class="">
> -        ResolveODR(Index, ExportList, GUIDPreservedSymbols, ModuleIdentifier, GV.first, *GV.second);<br class="">
> -    if (NewLinkage != GV.second->linkage()) {<br class="">
> -      ResolvedODR[GV.first] = NewLinkage;<br class="">
> -    }<br class="">
> -  }<br class="">
> +  for (auto &I : Index)<br class="">
> +    for (auto &S : I.second)<br class="">
> +      if (auto AS = dyn_cast<AliasSummary>(S.get()))<br class="">
> +        GlobalInvolvedWithAlias.insert(&AS->getAliasee());<br class="">
> +<br class="">
> +  for (auto &I : Index)<br class="">
> +    thinLTOResolveWeakForLinkerGUID(I.second, I.first, GlobalInvolvedWithAlias,<br class="">
> +                                    isPrevailing, isExported, recordNewLinkage);<br class="">
> }<br class="">
><br class="">
> -/// Fixup linkage, see ResolveODR() above.<br class="">
> -void fixupODR(<br class="">
> -    Module &TheModule,<br class="">
> -    const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR) {<br class="">
> -  // Process functions and global now<br class="">
> -  for (auto &GV : TheModule) {<br class="">
> -    auto NewLinkage = ResolvedODR.find(GV.getGUID());<br class="">
> -    if (NewLinkage == ResolvedODR.end())<br class="">
> -      continue;<br class="">
> -    DEBUG(dbgs() << "ODR fixing up linkage for `" << GV.getName() << "` from "<br class="">
> -                 << GV.getLinkage() << " to " << NewLinkage->second << "\n");<br class="">
> -    GV.setLinkage(NewLinkage->second);<br class="">
> -  }<br class="">
> -  for (auto &GV : TheModule.globals()) {<br class="">
> -    auto NewLinkage = ResolvedODR.find(GV.getGUID());<br class="">
> -    if (NewLinkage == ResolvedODR.end())<br class="">
> -      continue;<br class="">
> -    DEBUG(dbgs() << "ODR fixing up linkage for `" << GV.getName() << "` from "<br class="">
> -                 << GV.getLinkage() << " to " << NewLinkage->second << "\n");<br class="">
> -    GV.setLinkage(NewLinkage->second);<br class="">
> -  }<br class="">
> -  for (auto &GV : TheModule.aliases()) {<br class="">
> -    auto NewLinkage = ResolvedODR.find(GV.getGUID());<br class="">
> -    if (NewLinkage == ResolvedODR.end())<br class="">
> -      continue;<br class="">
> +/// Fixup WeakForLinker linkages in \p TheModule based on summary analysis.<br class="">
> +void thinLTOResolveWeakForLinkerModule(Module &TheModule,<br class="">
> +                                       const GVSummaryMapTy &DefinedGlobals) {<br class="">
> +  auto updateLinkage = [&](GlobalValue &GV) {<br class="">
> +    if (!GlobalValue::isWeakForLinker(GV.getLinkage()))<br class="">
> +      return;<br class="">
> +    // See if the global summary analysis computed a new resolved linkage.<br class="">
> +    const auto &GS = DefinedGlobals.find(GV.getGUID());<br class="">
> +    if (GS == DefinedGlobals.end())<br class="">
> +      return;<br class="">
> +    auto NewLinkage = GS->second->linkage();<br class="">
> +    if (NewLinkage == GV.getLinkage())<br class="">
> +      return;<br class="">
>     DEBUG(dbgs() << "ODR fixing up linkage for `" << GV.getName() << "` from "<br class="">
> -                 << GV.getLinkage() << " to " << NewLinkage->second << "\n");<br class="">
> -    GV.setLinkage(NewLinkage->second);<br class="">
> -  }<br class="">
> +                 << GV.getLinkage() << " to " << NewLinkage << "\n");<br class="">
> +    GV.setLinkage(NewLinkage);<br class="">
> +  };<br class="">
> +<br class="">
> +  // Process functions and global now<br class="">
> +  for (auto &GV : TheModule)<br class="">
> +    updateLinkage(GV);<br class="">
> +  for (auto &GV : TheModule.globals())<br class="">
> +    updateLinkage(GV);<br class="">
> +  for (auto &GV : TheModule.aliases())<br class="">
> +    updateLinkage(GV);<br class="">
> }<br class="">
><br class="">
> static StringMap<MemoryBufferRef><br class="">
> @@ -276,41 +284,30 @@ static void optimizeModule(Module &TheMo<br class="">
>   PM.run(TheModule);<br class="">
> }<br class="">
><br class="">
> -// Create a DenseSet of GlobalValue to be used with the Internalizer.<br class="">
> -static DenseSet<const GlobalValue *> computePreservedSymbolsForModule(<br class="">
> -    Module &TheModule, const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> -    const FunctionImporter::ExportSetTy &ExportList) {<br class="">
> -  DenseSet<const GlobalValue *> PreservedGV;<br class="">
> -  if (GUIDPreservedSymbols.empty())<br class="">
> -    // Early exit: internalize is disabled when there is nothing to preserve.<br class="">
> -    return PreservedGV;<br class="">
> -<br class="">
> -  auto AddPreserveGV = [&](const GlobalValue &GV) {<br class="">
> -    auto GUID = GV.getGUID();<br class="">
> -    if (GUIDPreservedSymbols.count(GUID) || ExportList.count(GUID))<br class="">
> -      PreservedGV.insert(&GV);<br class="">
> -  };<br class="">
> -<br class="">
> -  for (auto &GV : TheModule)<br class="">
> -    AddPreserveGV(GV);<br class="">
> -  for (auto &GV : TheModule.globals())<br class="">
> -    AddPreserveGV(GV);<br class="">
> -  for (auto &GV : TheModule.aliases())<br class="">
> -    AddPreserveGV(GV);<br class="">
> -<br class="">
> -  return PreservedGV;<br class="">
> -}<br class="">
> -<br class="">
> -// Run internalization on \p TheModule<br class="">
> -static void<br class="">
> -doInternalizeModule(Module &TheModule, const TargetMachine &TM,<br class="">
> -                    const DenseSet<const GlobalValue *> &PreservedGV) {<br class="">
> -  if (PreservedGV.empty()) {<br class="">
> -    // Be friendly and don't nuke totally the module when the client didn't<br class="">
> -    // supply anything to preserve.<br class="">
> -    return;<br class="">
> +static void thinLTOInternalizeAndPromoteGUID(<br class="">
> +    GlobalValueSummaryList &GVSummaryList, GlobalValue::GUID GUID,<br class="">
> +    std::function<bool(StringRef, GlobalValue::GUID)> isExported) {<br class="">
> +  for (auto &S : GVSummaryList) {<br class="">
> +    if (isExported(S->modulePath(), GUID)) {<br class="">
> +      if (GlobalValue::isLocalLinkage(S->linkage()))<br class="">
> +        S->setLinkage(GlobalValue::ExternalLinkage);<br class="">
> +    } else if (!GlobalValue::isLocalLinkage(S->linkage()))<br class="">
> +      S->setLinkage(GlobalValue::InternalLinkage);<br class="">
>   }<br class="">
> +}<br class="">
><br class="">
> +// Update the linkages in the given \p Index to mark exported values<br class="">
> +// as external and non-exported values as internal.<br class="">
> +void thinLTOInternalizeAndPromoteInIndex(<br class="">
> +    ModuleSummaryIndex &Index,<br class="">
> +    std::function<bool(StringRef, GlobalValue::GUID)> isExported) {<br class="">
> +  for (auto &I : Index)<br class="">
> +    thinLTOInternalizeAndPromoteGUID(I.second, I.first, isExported);<br class="">
> +}<br class="">
> +<br class="">
> +// Run internalization on \p TheModule based on symmary analysis.<br class="">
> +void thinLTOInternalizeModule(Module &TheModule,<br class="">
> +                              const GVSummaryMapTy &DefinedGlobals) {<br class="">
>   // Parse inline ASM and collect the list of symbols that are not defined in<br class="">
>   // the current module.<br class="">
>   StringSet<> AsmUndefinedRefs;<br class="">
> @@ -321,15 +318,37 @@ doInternalizeModule(Module &TheModule, c<br class="">
>           AsmUndefinedRefs.insert(Name);<br class="">
>       });<br class="">
><br class="">
> -  // Update the llvm.compiler_used globals to force preserving libcalls and<br class="">
> -  // symbols referenced from asm<br class="">
> -  UpdateCompilerUsed(TheModule, TM, AsmUndefinedRefs);<br class="">
> -<br class="">
>   // Declare a callback for the internalize pass that will ask for every<br class="">
>   // candidate GlobalValue if it can be internalized or not.<br class="">
> -  auto MustPreserveGV =<br class="">
> -      [&](const GlobalValue &GV) -> bool { return PreservedGV.count(&GV); };<br class="">
> +  auto MustPreserveGV = [&](const GlobalValue &GV) -> bool {<br class="">
> +    // Can't be internalized if referenced in inline asm.<br class="">
> +    if (AsmUndefinedRefs.count(GV.getName()))<br class="">
> +      return true;<br class="">
> +<br class="">
> +    // Lookup the linkage recorded in the summaries during global analysis.<br class="">
> +    const auto &GS = DefinedGlobals.find(GV.getGUID());<br class="">
> +    GlobalValue::LinkageTypes Linkage;<br class="">
> +    if (GS == DefinedGlobals.end()) {<br class="">
> +      // Must have been promoted (possibly conservatively). Find original<br class="">
> +      // name so that we can access the correct summary and see if it can<br class="">
> +      // be internalized again.<br class="">
> +      // FIXME: Eventually we should control promotion instead of promoting<br class="">
> +      // and internalizing again.<br class="">
> +      StringRef OrigName =<br class="">
> +          ModuleSummaryIndex::getOriginalNameBeforePromote(GV.getName());<br class="">
> +      std::string OrigId = GlobalValue::getGlobalIdentifier(<br class="">
> +          OrigName, GlobalValue::InternalLinkage,<br class="">
> +          TheModule.getSourceFileName());<br class="">
> +      const auto &GS = DefinedGlobals.find(GlobalValue::getGUID(OrigId));<br class="">
> +      assert(GS != DefinedGlobals.end());<br class="">
> +      Linkage = GS->second->linkage();<br class="">
> +    } else<br class="">
> +      Linkage = GS->second->linkage();<br class="">
> +    return !GlobalValue::isLocalLinkage(Linkage);<br class="">
> +  };<br class="">
><br class="">
> +  // FIXME: See if we can just internalize directly here via linkage changes<br class="">
> +  // based on the index, rather than invoking internalizeModule.<br class="">
>   llvm::internalizeModule(TheModule, MustPreserveGV);<br class="">
> }<br class="">
><br class="">
> @@ -483,22 +502,16 @@ public:<br class="">
>   }<br class="">
> };<br class="">
><br class="">
> -static std::unique_ptr<MemoryBuffer> ProcessThinLTOModule(<br class="">
> -    Module &TheModule, const ModuleSummaryIndex &Index,<br class="">
> -    StringMap<MemoryBufferRef> &ModuleMap, TargetMachine &TM,<br class="">
> -    const FunctionImporter::ImportMapTy &ImportList,<br class="">
> -    const FunctionImporter::ExportSetTy &ExportList,<br class="">
> -    const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> -    std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,<br class="">
> -    ThinLTOCodeGenerator::CachingOptions CacheOptions, bool DisableCodeGen,<br class="">
> -    StringRef SaveTempsDir, unsigned count) {<br class="">
> -<br class="">
> -  // Prepare for internalization by computing the set of symbols to preserve.<br class="">
> -  // We need to compute the list of symbols to preserve during internalization<br class="">
> -  // before doing any promotion because after renaming we won't (easily) match<br class="">
> -  // to the original name.<br class="">
> -  auto PreservedGV = computePreservedSymbolsForModule(<br class="">
> -      TheModule, GUIDPreservedSymbols, ExportList);<br class="">
> +static std::unique_ptr<MemoryBuffer><br class="">
> +ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,<br class="">
> +                     StringMap<MemoryBufferRef> &ModuleMap, TargetMachine &TM,<br class="">
> +                     const FunctionImporter::ImportMapTy &ImportList,<br class="">
> +                     const FunctionImporter::ExportSetTy &ExportList,<br class="">
> +                     const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> +                     const GVSummaryMapTy &DefinedGlobals,<br class="">
> +                     ThinLTOCodeGenerator::CachingOptions CacheOptions,<br class="">
> +                     bool DisableCodeGen, StringRef SaveTempsDir,<br class="">
> +                     unsigned count) {<br class="">
><br class="">
>   // "Benchmark"-like optimization: single-source case<br class="">
>   bool SingleModule = (ModuleMap.size() == 1);<br class="">
> @@ -506,17 +519,19 @@ static std::unique_ptr<MemoryBuffer> Pro<br class="">
>   if (!SingleModule) {<br class="">
>     promoteModule(TheModule, Index);<br class="">
><br class="">
> -    // Resolve the LinkOnce/Weak ODR, trying to turn them into<br class="">
> -    // "available_externally" when possible.<br class="">
> -    // This is a compile-time optimization.<br class="">
> -    fixupODR(TheModule, ResolvedODR);<br class="">
> +    // Apply summary-based LinkOnce/Weak resolution decisions.<br class="">
> +    thinLTOResolveWeakForLinkerModule(TheModule, DefinedGlobals);<br class="">
><br class="">
>     // Save temps: after promotion.<br class="">
>     saveTempBitcode(TheModule, SaveTempsDir, count, ".1.promoted.bc");<br class="">
>   }<br class="">
><br class="">
> -  // Internalization<br class="">
> -  doInternalizeModule(TheModule, TM, PreservedGV);<br class="">
> +  // Be friendly and don't nuke totally the module when the client didn't<br class="">
> +  // supply anything to preserve.<br class="">
> +  if (!ExportList.empty() || !GUIDPreservedSymbols.empty()) {<br class="">
> +    // Apply summary-based internalization decisions.<br class="">
> +    thinLTOInternalizeModule(TheModule, DefinedGlobals);<br class="">
> +  }<br class="">
><br class="">
>   // Save internalized bitcode<br class="">
>   saveTempBitcode(TheModule, SaveTempsDir, count, ".2.internalized.bc");<br class="">
> @@ -546,6 +561,45 @@ static std::unique_ptr<MemoryBuffer> Pro<br class="">
>   return codegenModule(TheModule, TM);<br class="">
> }<br class="">
><br class="">
> +/// Resolve LinkOnce/Weak symbols. Record resolutions in the \p ResolvedODR map<br class="">
> +/// for caching, and in the \p Index for application during the ThinLTO<br class="">
> +/// backends. This is needed for correctness for exported symbols (ensure<br class="">
> +/// at least one copy kept) and a compile-time optimization (to drop duplicate<br class="">
> +/// copies when possible).<br class="">
> +static void resolveWeakForLinkerInIndex(<br class="">
> +    ModuleSummaryIndex &Index,<br class="">
> +    const StringMap<FunctionImporter::ExportSetTy> &ExportLists,<br class="">
> +    const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,<br class="">
> +    StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>><br class="">
> +        &ResolvedODR) {<br class="">
> +<br class="">
> +  DenseMap<GlobalValue::GUID, const GlobalValueSummary *> PrevailingCopy;<br class="">
> +  computePrevailingCopies(Index, PrevailingCopy);<br class="">
> +<br class="">
> +  auto isPrevailing = [&](GlobalValue::GUID GUID, const GlobalValueSummary *S) {<br class="">
> +    const auto &Prevailing = PrevailingCopy.find(GUID);<br class="">
> +    // Not in map means that there was only one copy, which must be prevailing.<br class="">
> +    if (Prevailing == PrevailingCopy.end())<br class="">
> +      return true;<br class="">
> +    return Prevailing->second == S;<br class="">
> +  };<br class="">
> +<br class="">
> +  auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {<br class="">
> +    const auto &ExportList = ExportLists.find(ModuleIdentifier);<br class="">
> +    assert(ExportList != ExportLists.end() && "Missing export list for module");<br class="">
> +    return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);<br class="">
> +  };<br class="">
> +<br class="">
> +  auto recordNewLinkage = [&](StringRef ModuleIdentifier,<br class="">
> +                              GlobalValue::GUID GUID,<br class="">
> +                              GlobalValue::LinkageTypes NewLinkage) {<br class="">
> +    ResolvedODR[ModuleIdentifier][GUID] = NewLinkage;<br class="">
> +  };<br class="">
> +<br class="">
> +  thinLTOResolveWeakForLinkerInIndex(Index, isPrevailing, isExported,<br class="">
> +                                     recordNewLinkage);<br class="">
> +}<br class="">
> +<br class="">
> // Initialize the TargetMachine builder for a given Triple<br class="">
> static void initTMBuilder(TargetMachineBuilder &TMBuilder,<br class="">
>                           const Triple &TheTriple) {<br class="">
> @@ -641,6 +695,7 @@ std::unique_ptr<ModuleSummaryIndex> Thin<br class="">
><br class="">
> /**<br class="">
>  * Perform promotion and renaming of exported internal functions.<br class="">
> + * Index is updated to reflect linkage changes from weak resolution.<br class="">
>  */<br class="">
> void ThinLTOCodeGenerator::promote(Module &TheModule,<br class="">
>                                    ModuleSummaryIndex &Index) {<br class="">
> @@ -655,21 +710,18 @@ void ThinLTOCodeGenerator::promote(Modul<br class="">
>   StringMap<FunctionImporter::ExportSetTy> ExportLists(ModuleCount);<br class="">
>   ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries, ImportLists,<br class="">
>                            ExportLists);<br class="">
> -  auto &ExportList = ExportLists[ModuleIdentifier];<br class="">
><br class="">
>   // Convert the preserved symbols set from string to GUID<br class="">
>   auto GUIDPreservedSymbols =<br class="">
>   computeGUIDPreservedSymbols(PreservedSymbols, TMBuilder.TheTriple);<br class="">
><br class="">
> -  // Resolve the LinkOnceODR, trying to turn them into "available_externally"<br class="">
> -  // where possible.<br class="">
> -  // This is a compile-time optimization.<br class="">
> -  // We use a std::map here to be able to have a defined ordering when<br class="">
> -  // producing a hash for the cache entry.<br class="">
> -  std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> ResolvedODR;<br class="">
> -  ResolveODR(Index, ExportList, GUIDPreservedSymbols, ModuleToDefinedGVSummaries[ModuleIdentifier],<br class="">
> -             ModuleIdentifier, ResolvedODR);<br class="">
> -  fixupODR(TheModule, ResolvedODR);<br class="">
> +  // Resolve LinkOnce/Weak symbols.<br class="">
> +  StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR;<br class="">
> +  resolveWeakForLinkerInIndex(Index, ExportLists, GUIDPreservedSymbols,<br class="">
> +                              ResolvedODR);<br class="">
> +<br class="">
> +  thinLTOResolveWeakForLinkerModule(<br class="">
> +      TheModule, ModuleToDefinedGVSummaries[ModuleIdentifier]);<br class="">
><br class="">
>   promoteModule(TheModule, Index);<br class="">
> }<br class="">
> @@ -744,7 +796,7 @@ void ThinLTOCodeGenerator::emitImports(S<br class="">
> }<br class="">
><br class="">
> /**<br class="">
> - * Perform internalization.<br class="">
> + * Perform internalization. Index is updated to reflect linkage changes.<br class="">
>  */<br class="">
> void ThinLTOCodeGenerator::internalize(Module &TheModule,<br class="">
>                                        ModuleSummaryIndex &Index) {<br class="">
> @@ -767,10 +819,20 @@ void ThinLTOCodeGenerator::internalize(M<br class="">
>                            ExportLists);<br class="">
>   auto &ExportList = ExportLists[ModuleIdentifier];<br class="">
><br class="">
> +  // Be friendly and don't nuke totally the module when the client didn't<br class="">
> +  // supply anything to preserve.<br class="">
> +  if (ExportList.empty() && GUIDPreservedSymbols.empty())<br class="">
> +    return;<br class="">
> +<br class="">
>   // Internalization<br class="">
> -  auto PreservedGV = computePreservedSymbolsForModule(<br class="">
> -      TheModule, GUIDPreservedSymbols, ExportList);<br class="">
> -  doInternalizeModule(TheModule, *TMBuilder.create(), PreservedGV);<br class="">
> +  auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {<br class="">
> +    const auto &ExportList = ExportLists.find(ModuleIdentifier);<br class="">
> +    assert(ExportList != ExportLists.end() && "Missing export list for module");<br class="">
> +    return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);<br class="">
> +  };<br class="">
> +  thinLTOInternalizeAndPromoteInIndex(Index, isExported);<br class="">
> +  thinLTOInternalizeModule(TheModule,<br class="">
> +                           ModuleToDefinedGVSummaries[ModuleIdentifier]);<br class="">
> }<br class="">
><br class="">
> /**<br class="">
> @@ -853,6 +915,28 @@ void ThinLTOCodeGenerator::run() {<br class="">
>   auto GUIDPreservedSymbols =<br class="">
>       computeGUIDPreservedSymbols(PreservedSymbols, TMBuilder.TheTriple);<br class="">
><br class="">
> +  // We use a std::map here to be able to have a defined ordering when<br class="">
> +  // producing a hash for the cache entry.<br class="">
> +  // FIXME: we should be able to compute the caching hash for the entry based<br class="">
> +  // on the index, and nuke this map.<br class="">
> +  StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR;<br class="">
> +<br class="">
> +  // Resolve LinkOnce/Weak symbols, this has to be computed early because it<br class="">
> +  // impacts the caching.<br class="">
> +  resolveWeakForLinkerInIndex(*Index, ExportLists, GUIDPreservedSymbols,<br class="">
> +                              ResolvedODR);<br class="">
> +<br class="">
> +  auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {<br class="">
> +    const auto &ExportList = ExportLists.find(ModuleIdentifier);<br class="">
> +    assert(ExportList != ExportLists.end() && "Missing export list for module");<br class="">
> +    return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);<br class="">
> +  };<br class="">
> +<br class="">
> +  // Use global summary-based analysis to identify symbols that can be<br class="">
> +  // internalized (because they aren't exported or preserved as per callback).<br class="">
> +  // Changes are made in the index, consumed in the ThinLTO backends.<br class="">
> +  thinLTOInternalizeAndPromoteInIndex(*Index, isExported);<br class="">
> +<br class="">
>   // Make sure that every module has an entry in the ExportLists to enable<br class="">
>   // threaded access to this map below<br class="">
>   for (auto &DefinedGVSummaries : ModuleToDefinedGVSummaries)<br class="">
> @@ -882,18 +966,11 @@ void ThinLTOCodeGenerator::run() {<br class="">
><br class="">
>         auto &DefinedFunctions = ModuleToDefinedGVSummaries[ModuleIdentifier];<br class="">
><br class="">
> -        // Resolve ODR, this has to be done early because it impacts the caching<br class="">
> -        // We use a std::map here to be able to have a defined ordering when<br class="">
> -        // producing a hash for the cache entry.<br class="">
> -        std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> ResolvedODR;<br class="">
> -        ResolveODR(*Index, ExportList, GUIDPreservedSymbols, DefinedFunctions, ModuleIdentifier,<br class="">
> -                   ResolvedODR);<br class="">
> -<br class="">
>         // The module may be cached, this helps handling it.<br class="">
>         ModuleCacheEntry CacheEntry(CacheOptions.Path, *Index, ModuleIdentifier,<br class="">
>                                     ImportLists[ModuleIdentifier], ExportList,<br class="">
> -                                    ResolvedODR, DefinedFunctions,<br class="">
> -                                    GUIDPreservedSymbols);<br class="">
> +                                    ResolvedODR[ModuleIdentifier],<br class="">
> +                                    DefinedFunctions, GUIDPreservedSymbols);<br class="">
><br class="">
>         {<br class="">
>           auto ErrOrBuffer = CacheEntry.tryLoadingBuffer();<br class="">
> @@ -922,7 +999,8 @@ void ThinLTOCodeGenerator::run() {<br class="">
>         // Run the main process now, and generates a binary<br class="">
>         auto OutputBuffer = ProcessThinLTOModule(<br class="">
>             *TheModule, *Index, ModuleMap, *TMBuilder.create(), ImportList,<br class="">
> -            ExportList, GUIDPreservedSymbols, ResolvedODR, CacheOptions,<br class="">
> +            ExportList, GUIDPreservedSymbols,<br class="">
> +            ModuleToDefinedGVSummaries[ModuleIdentifier], CacheOptions,<br class="">
>             DisableCodeGen, SaveTempsDir, count);<br class="">
><br class="">
>         OutputBuffer = CacheEntry.write(std::move(OutputBuffer));<br class="">
><br class="">
><br class="">
> _______________________________________________<br class="">
> llvm-commits mailing list<br class="">
> <a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
<br class="">
</div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><span style="font-family: Times; font-size: inherit;" class=""><table cellspacing="0" cellpadding="0" class=""><tbody class=""><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small" class=""><td nowrap="" style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" class="">Teresa Johnson |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" class=""> Software Engineer |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" class=""> <a href="mailto:tejohnson@google.com" target="_blank" class="">tejohnson@google.com</a> |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" class=""> 408-460-2413</td></tr></tbody></table></span></div>
</div>
</div></blockquote></div><br class=""></div></body></html>