<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 2:25 PM, Taewook Oh <span dir="ltr"><<a href="mailto:twoh@fb.com" target="_blank">twoh@fb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">







<div bgcolor="white" lang="EN-US">
<div class="m_7471924872012567099gmail-m_-1862324745509867527WordSection1">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Hello Teresa,<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Thank you for your analysis. One thing to note is that the global materializer materializes the value as a function declaration, not a function definition. As I pasted on my first email,
<u></u><u></u></span></p><span class="m_7471924872012567099gmail-">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">; Materializable<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">; Function Attrs: nounwind uwtable<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">define weak_odr void @foo(%1*) unnamed_addr #7 comdat($comdat1) align 2 personality i32 (...)* @__gxx_personality_v0 {}<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
</span><p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">is materialized to
<u></u><u></u></span></p><span class="m_7471924872012567099gmail-">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">; Function Attrs: nounwind uwtable<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">declare void @foo(%"type1"*) unnamed_addr #2 align 2<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
</span><p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Inside IRLinker::linkGlobalValueProto, the materialized value is returned from getLinkedToGlobal(SGV) and assigned to DGV. However, as ForAlias is true and ShouldLink is false, DGV becomes
 nullptr later, and NewGV is created from copyGlobalValueProto(SGV, ShouldLink) call. Therefore, returned value from linkGlobalValueProto is different from the value obtained by ValueMap.lookup(SGV) in IRLinker::materialize.</span></p></div></div></blockquote><div><br></div><div>Ah, sorry, somehow I completely missed the fact that it was brought in as a decl when I looked this morning.</div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div bgcolor="white" lang="EN-US"><div class="m_7471924872012567099gmail-m_-1862324745509867527WordSection1"><p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">BTW, I updated LLVM to the latest version in SVN this morning, and the assertion failure is gone. Instead, it ends up with broken module found errors:<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Global is external, but doesn't have external or weak linkage!<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">void (%2*, %2*, i32)* @"_foo.llvm.E5F1952C"<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">function declaration may not have a !dbg attachment<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">void (%2*, %2*, i32)* @"_foo.llvm.E5F1952C"<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">LLVM ERROR: Broken module found, compilation aborted!</span></p></div></div></blockquote><div><br></div><div>This looks like a promoted local from the name. What is the linkage type? Is this the verifier run right after the importing pass?</div><div><br></div><div>I'm guessing the first problem went away due to luck, as I can't think of any specific change that would have affected it. Is this from the same module?</div><div><br></div><div>Do you know what SVN revision were you at before, even roughly?</div><div><br></div><div>Teresa</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div bgcolor="white" lang="EN-US"><div class="m_7471924872012567099gmail-m_-1862324745509867527WordSection1"><p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Hope this provides additional clues to fix the issue.
<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Thanks,<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri">Taewook<u></u><u></u></span></p>
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-size:11pt;font-family:calibri"><u></u> <u></u></span></p>
<div style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-style:solid none none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-top-width:1pt;border-top-color:rgb(181,196,223);padding:3pt 0in 0in">
<p class="m_7471924872012567099gmail-MsoNormal"><b><span style="font-family:calibri;color:black">From: </span>
</b><span style="font-family:calibri;color:black">Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>><br>
<b>Date: </b>Friday, July 29, 2016 at 7:05 AM</span></p><div><div class="m_7471924872012567099gmail-h5"><br>
<b>To: </b>Taewook Oh <<a href="mailto:twoh@fb.com" target="_blank">twoh@fb.com</a>><br>
<b>Cc: </b>via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [llvm-dev] [ThinLTO] assert(GS != DefinedGlobals.end()) failed in FunctionImport.cpp<u></u><u></u></div></div><p></p>
</div><div><div class="m_7471924872012567099gmail-h5">
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">On Thu, Jul 28, 2016 at 5:18 PM, Taewook Oh <<a href="mailto:twoh@fb.com" target="_blank">twoh@fb.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-style:none none none solid;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri">Hello Teresa,</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri">Thank you for your reply. I’m trying to create a small repro but find it hard to nail down because originally it is a big build. This happens with gold linker.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">I think I need to see a smaller test case, looking through the code I'm not sure how we ended up in this situation. See analysis below.<u></u><u></u></p>
</div>
<blockquote style="border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-style:none none none solid;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri">Thanks,</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri">Taewook</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-size:11pt;font-family:calibri"> </span><u></u><u></u></p>
<div style="border-style:solid none none;border-top-width:1pt;border-top-color:rgb(181,196,223);padding:3pt 0in 0in;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial">
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><b><span style="font-family:calibri;color:black">From:
</span></b><span style="font-family:calibri;color:black">Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>><br>
<b>Date: </b>Thursday, July 28, 2016 at 5:08 PM<br>
<b>To: </b>Taewook Oh <<a href="mailto:twoh@fb.com" target="_blank">twoh@fb.com</a>><br>
<b>Cc: </b>via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [llvm-dev] [ThinLTO] assert(GS != DefinedGlobals.end()) failed in FunctionImport.cpp</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Hi Taewook, <u></u><u></u></p>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">On Thu, Jul 28, 2016 at 4:38 PM, Taewook Oh via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial">
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">Encountered “assert(GS != DefinedGlobals.end())” failure while running ThinLTO. The assertion statement is in MustPreserveGV lambda function in llvm::thinLTOInternalizeModule
 (lib/Transforms/IPO/FunctionImport.cpp).</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">It seems that the assertion fails because it fails to recover the "original name" of the global value. ModuleSummaryIndex::getOriginalNameBeforePromote attempts to get the original
 name by stripping .llvm.{HASH}, but what I observe is that ".1" is still appended to the expected original name.
</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">Then where this extra ".1" comes from? It is appended when the global value is materialized. IRLinker::materialize function calls IRLinker::linkGlobalValueProto function, and
 inside that function if DGV is nullptr or ShouldLink is true then IRLinker::copyGlobalValueProto function is called to create a global variable in the destination module that corresponds to SGV. I found that newly created global variable has the extra ".1"
 added to the name of the SGV. </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">When this happens? I don't have a complete understanding but I observed that the same global value is materialized twice during the single invocation of IRLinker::run, once
 with GlobalValueMaterializer and once with LocalValueMaterializer. First, the global value</span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">Looking at the IRLinker, it appears this second (local) copy should only be created if there was no copy already linked in from the same source module:<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">In IRLinker::linkGlobalValueProto, we should find the DGV created by the GlobalValueMaterializer for the same SGV (first find it by name, then if ShouldLink==true, we should find it in ValueMap and return that entry, or if ShouldLink==false,
 since ForAlias=true we should return null.<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">Then when linkGlobalValueProto returns, in IRLinker::materialize there is specific handling for this case:<u></u><u></u></p>
</div>
<p class="m_7471924872012567099gmail-MsoNormal">  // When linking a global for an alias, it will always be linked. However we<br>
  // need to check if it was not already scheduled to satify a reference from a<br>
  // regular global value initializer. We know if it has been schedule if the<br>
  // "New" GlobalValue that is mapped here for the alias is the same as the one<br>
  // already mapped. If there is an entry in the ValueMap but the value is<br>
  // different, it means that the value already had a definition in the<br>
  // destination module (linkonce for instance), but we need a new definition<br>
  // for the alias ("New" will be different.<br>
  if (ForAlias && ValueMap.lookup(SGV) == New)<br>
    return New; <u></u><u></u></p>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">AFAICT the only way we should be creating a new local copy is if foo() already had a copy in the dest module. But when we call ThinLTO internalization we are doing so before any function importing. The gold-plugin should have linked the
 module being compiled in the ThinLTO backend into an empty module from thinLTOBackendTask, so we should not already have a copy of foo() in the dest module.<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">I must be missing something...in lieu of a smaller test case, can you trace through what happens when we call linkGlobalValueProto for the local materializer, and see why we don't find the copy of SGV already materialized by the global
 materializer which should be in the ValueMap?<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal">Teresa<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-style:none none none solid;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Yes, the IRLinker will append an integer if it encounters a naming conflict. Normally this would happen in full LTO, but I guess is happening here since we are linking twice due to the alias.<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial">
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">; Materializable</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">; Function Attrs: nounwind uwtable</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">define weak_odr void @foo(%1*) unnamed_addr #7 comdat($comdat1) align 2 personality i32 (...)* @__gxx_personality_v0 {}</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">(I renamed the function and comdat)</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">is materialized with GlobalValueMaterializer, (so the IRLinker::materialize function is called with ForAlias == false), and the materialized value is</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">; Function Attrs: nounwind uwtable</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">declare void @foo(%"type1"*) unnamed_addr #2 align 2</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">Then, later, the same value is materialized again with LocalValueMaterializer (so ForAlias == true for IRLinker::materialize), and the materialized value is</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">; Function Attrs: nounwind uwtable</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">define internal void @foo.1(%"type 0x7efb6ee89d80"*) unnamed_addr #2 comdat($comdat1) align 2 personality i32 (...)* @__gxx_personality_v0 !dbg !12345 {</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">  // function definition</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">}</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">(here, “type 0x7efb6ee89d80” is not “type1” )</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">So for me it seems that we need a mechanism to retrieve the original name of the global value even when it is renamed during the materialization. I submitted the bug report
 as well (<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D28760-29&d=CwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kOsLCgQzH7N8ptZ7diJD9g&m=XtlNH01OW0mwOi0no2wur-HO6RY5szj-dgWaIcCki-k&s=9pGLGnxeOI3J3lvx9-ayiZJUImAefSzcGGJN5xo9_Kc&e=" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=28760)</a>.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Interestingly, we are already trying to handle a similar case in that lambda (see the comment about weak values linked in as a local copy due to an alias). However, we weren't anticipating the original weak value being linked in as
 well, which is causing the rename.<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Do you have a small reproducer? Is this with gold? I need to think about the best way to handle this case. One way of course is to conservatively return true if we can't find it in the map, but I don't love that since we may miss
 other cases that need to be handled.<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">Teresa<u></u><u></u></p>
</div>
<blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial">
<div>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">Thanks,</span><u></u><u></u></p>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-m1800117222592206986gmail-msonormal"><span style="font-size:11pt">Taewook</span><u></u><u></u></p>
</div>
</div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal" style="margin-bottom:12pt"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=CwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kOsLCgQzH7N8ptZ7diJD9g&m=XtlNH01OW0mwOi0no2wur-HO6RY5szj-dgWaIcCki-k&s=eA2ODuBrwjiWfuW-_sPfCVr1H774iHS5j89ydb7KY2E&e=" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal">-- <u></u><u></u></p>
<div>
<table class="m_7471924872012567099gmail-m_-1862324745509867527MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td nowrap style="border-style:solid none none;border-top-width:1.5pt;border-top-color:rgb(213,15,37);padding:0in;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial">
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-family:helvetica;color:rgb(85,85,85)">Teresa Johnson |</span><u></u><u></u></p>
</td>
<td nowrap style="border-style:solid none none;border-top-width:1.5pt;border-top-color:rgb(51,105,232);padding:0in;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial">
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> Software Engineer |</span><u></u><u></u></p>
</td>
<td nowrap style="border-style:solid none none;border-top-width:1.5pt;border-top-color:rgb(0,153,57);padding:0in;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial">
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</span><u></u><u></u></p>
</td>
<td nowrap style="border-style:solid none none;border-top-width:1.5pt;border-top-color:rgb(238,178,17);padding:0in;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial">
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> <a href="tel:408-460-2413" target="_blank">408-460-2413</a></span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="m_7471924872012567099gmail-m_-1862324745509867527gmail-msonormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="m_7471924872012567099gmail-MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
<p class="m_7471924872012567099gmail-MsoNormal">-- <u></u><u></u></p>
<div>
<table class="m_7471924872012567099gmail-m_-1862324745509867527MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td nowrap style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-style:solid none none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-top-width:1.5pt;border-top-color:rgb(213,15,37);padding:0in">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-family:helvetica;color:rgb(85,85,85)">Teresa Johnson |<u></u><u></u></span></p>
</td>
<td nowrap style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-style:solid none none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-top-width:1.5pt;border-top-color:rgb(51,105,232);padding:0in">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> Software Engineer |<u></u><u></u></span></p>
</td>
<td nowrap style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-style:solid none none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-top-width:1.5pt;border-top-color:rgb(0,153,57);padding:0in">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |<u></u><u></u></span></p>
</td>
<td nowrap style="border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-style:solid none none;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-top-width:1.5pt;border-top-color:rgb(238,178,17);padding:0in">
<p class="m_7471924872012567099gmail-MsoNormal"><span style="font-family:helvetica;color:rgb(85,85,85)"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="m_7471924872012567099gmail-MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_7471924872012567099gmail_signature"><span style="font-family:times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div></div>