<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I am not sure what is imported entry is, and if it could be located inside a lexical block.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">When you create an imported entry you call the “getOrCreateContextDIE”, this function will check for, Compile-Unit, File, Namespace, Type, Subprogram context.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If none match, it calls “getDIE” function:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">DIE *DwarfUnit::getDIE(<span style="color:blue">const</span> DINode *D)
<span style="color:blue">const</span> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> 
<span style="color:blue">if</span> (isShareableAcrossCUs(D))<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:blue">return</span> DU->getDIE(D);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> 
<span style="color:blue">return</span> MDNodeToDieMap.lookup(D);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Maybe imported entries fit with the first condition check of “</span><span style="font-size:9.5pt;font-family:Consolas">isShareableAcrossCUs</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">”,
 but the function static variables will have a lexical block context and when we will look for this context in the “</span><span style="font-size:9.5pt;font-family:Consolas">MDNodeToDieMap</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">”
 map it will not be there, because we do not map lexical block MDNode to lexical block DIE.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Also, right now, we decide if to create the lexical block DIE or not depends on the local variable children only, as the function static variables DIE and the
 type DIEs were not attached yet to the lexical block DIE.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This, is why I also suggest to create all lexical blocks at first and once all its children are created, we can revisit this lexical block FIE and decide if
 it worth collapsing with parent.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Amjad<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:dblaikie@gmail.com]
<br>
<b>Sent:</b> Wednesday, May 27, 2015 21:14<br>
<b>To:</b> reviews+D9960+public+41c324f590718ccc@reviews.llvm.org<br>
<b>Cc:</b> Aboud, Amjad; Eric Christopher; Benjamin Kramer; llvm-commits@cs.uiuc.edu; Robinson, Paul<br>
<b>Subject:</b> Re: [PATCH] Refactor debug info lexical block generation<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Perhaps it'd be good to have a general design discussion here, rather than in the form of line-by-line code review. A few broad issues have been brought up by both Paul and Frederic that sound reasonable to me, though I've not looked at
 the code in detail yet.<br>
<br>
Is there any reason this wouldn't be implemented the same way as the imported entity work? Where we check for imported entities at scope construction time to decide whether to create that scope or not.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Sun, May 24, 2015 at 9:00 AM, Amjad Aboud <<a href="mailto:amjad.aboud@intel.com" target="_blank">amjad.aboud@intel.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Hi echristo, bkramer, dblaikie,<br>
<br>
This patch is needed for resolving Bug 19238.<br>
It is the first part which will be followed by D9758.<br>
<br>
The idea is to create all debug info lexical block DIEs and add them to the DIScope->DIE map.<br>
Latter, just before emitting the DIEs, we will search the DIE tree and collapse all redundant (useless) DIE lexical blocks.<br>
<br>
REPOSITORY<br>
  rL LLVM<br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9960&d=AwMGaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=aInbtRyJuf9WbPW57V7WrzeF_bmzcgb1a782k-9W_ys&s=qw6s5_4gb3GooIBXZGcXi6LMCypqvME1BFh_xaWpaKk&e=" target="_blank">http://reviews.llvm.org/D9960</a><br>
<br>
Files:<br>
  include/llvm/CodeGen/DIE.h<br>
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
  test/DebugInfo/useless_lexical_scope.ll<br>
<br>
EMAIL PREFERENCES<br>
  <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMGaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=aInbtRyJuf9WbPW57V7WrzeF_bmzcgb1a782k-9W_ys&s=waTPe1nw0kMaEKmufCEb_KHnFpNXRzsCgJkIOiNPL-A&e=" target="_blank">
http://reviews.llvm.org/settings/panel/emailpreferences/</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>