<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 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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 don’t think its true for all kinds of dead code elimination because there may be instructions which do execute but can be proven to be redundant/dead.<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">Lets say you do a bit-width analysis ( something along the lines of
<a href="http://www.cs.cmu.edu/~seth/papers/budiu-tr00.pdf">http://www.cs.cmu.edu/~seth/papers/budiu-tr00.pdf</a> ). You may be able to remove some instructions and get runtime benefit ( which may have nothing to do with IC miss behavior because these were
 instructions that were getting executed ). <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">Anyway, the advanced analyses for DCE may not apply to this RFC. So we may not see any runtime benefits.
<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:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Daniel Berlin [mailto:dberlin@dberlin.org]
<br>
<b>Sent:</b> Tuesday, August 02, 2016 9:26 PM<br>
<b>To:</b> Das, Dibyendu <Dibyendu.Das@amd.com><br>
<b>Cc:</b> David Callahan <dcallahan@fb.com>; llvm-dev@lists.llvm.org; Nadav Rotem <nrotem@fb.com><br>
<b>Subject:</b> Re: [llvm-dev] [LLVM] New Dead Code Elimination<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">You should not expect pretty much any perf uplifts from any DCE, ever.<o:p></o:p></p>
<div>
<p class="MsoNormal">If it does, it's mostly luck (better cache behavior, etc).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">You should expect size improvements ;)<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Aug 1, 2016 at 10:51 PM, Das, Dibyendu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">What kind of perf. uplifts are expected and in what benchmarks/apps ?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:11.0pt">From:</span></b><span style="font-size:11.0pt"> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>David Callahan via llvm-dev<br>
<b>Sent:</b> Monday, August 01, 2016 11:15 PM<br>
<b>To:</b> LLVM Dev Mailing list <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Cc:</b> Nadav Rotem <<a href="mailto:nrotem@fb.com" target="_blank">nrotem@fb.com</a>><br>
<b>Subject:</b> [llvm-dev] [LLVM] New Dead Code Elimination</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">I have a rewrite of the aggressive dead code elimination pass which handles control flow and allows may-be-infinite loops to be removed under optional
 flag. Chandler suggested rather than a large change a series of small changes and, while that may not get us to small changes easily, there has been no further commentary on the diff:
<a href="https://reviews.llvm.org/D18762" target="_blank">https://reviews.llvm.org/D18762</a>.  Given that, I will plan on proposing a series of diffs and would like to recruit some people who are interested in the change to help review those changes.
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">I expect to stage as follows:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black"> </span><o:p></o:p></p>
<p><span style="color:black">1.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Rewrite base algorithm to introduce data structures needed to hold extra information (no functional change)</span><o:p></o:p></p>
<p><span style="color:black">2.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Rewrite base algorithm to allow removing of control flow (under option, off by default). This variant will not be correct in the general case.</span><o:p></o:p></p>
<p><span style="color:black">3.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Code to rewrite the control flow graph and remove dead basic blocks</span><o:p></o:p></p>
<p><span style="color:black">4.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Identify Phi nodes with non-instruction reaching definitions and keep the associated source block live. Identify Phi nodes with multiple-live values from dead blocks</span><o:p></o:p></p>
<p><span style="color:black">5.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Remove unreachable code discovered by post-order traversal to avoid.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.25in;text-indent:.25in">
<span style="color:black"> (code is functionally correct at this point)</span><o:p></o:p></p>
<p><span style="color:black">6.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Use post-order traversal to identify loop bottoms. By default this will be kept live but include switch to allow loops to be removed. 
</span><o:p></o:p></p>
<p><span style="color:black">7.</span><span style="font-size:7.0pt;color:black">    
</span><span style="color:black">Improve handling of live values out of dead regions</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">Please respond if you are willing to help or have suggestions on staging or approach.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">Thanks</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">David</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>