<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;}
/* 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";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {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" style="margin-left:.5in">you could phrase the test in terms of comparing optnone and non-optnone behavior, ensuring they produce identical answers?<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For optnone tests in general, comparing non-O0 optnone and –O0 non-optnone is what we want.  I don't see a way to persuade llc to apply different attributes
 to a function based on RUN line parameters, so the naïve run-twice-and-diff approach doesn't seem applicable. So, existing optnone tests compile functions with optnone and look for particular instructions.<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">In this specific case, it's complexified by needing an O0 case that bails out of fast-isel and then triggers a DAG combine, which is what the test would actually
 be looking for.  Thus, the test inherently depends on having some situation where fast-isel will bail out.  I know a way to make that work, but if somebody wants to provide a more robust tactic for writing a test that bails out of fast-isel, I'm happy to adopt
 it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<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>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<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, March 25, 2015 10:34 AM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-commits@cs.uiuc.edu<br>
<b>Subject:</b> Re: [llvm] r233153 - 'optnone' should not disable DAG combiner.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Mar 25, 2015 at 8:46 AM, Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p style="margin-left:.5in"><a name="14c519ce5563d341__MailEndCompose">Leave the test case in and switch the expectation (& perhaps add a comment explaining why this the right choice and the previous one wasn't) so there's breadcrumbs if anyone else gets the
 same idea again in the future?</a><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;font-family:"Calibri","sans-serif";color:#1F497D">Hmmmm the conditions where the test failed were pretty obscure and we used a sledgehammer to drive
 a finishing nail. But I could see a way to make the test prove that if an optnone function bails out of fast-isel, the DAG combiner does run, which would be the point you're driving at.  It'd get a false failure if fast-isel got smarter but with the right
 commentary that ought to be okay.  Will work on this later today.</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><br>
To keep the test non-brittle (though perhaps it'd become pointless, rather than a false failure) you could phrase the test in terms of comparing optnone and non-optnone behavior, ensuring they produce identical answers? Maybe - perhaps that's not a good idea,
 I'm not sure.<br>
<br>
- David<br>
 <o:p></o:p></p>
</div>
<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;font-family:"Calibri","sans-serif";color:#1F497D">--paulr</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;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 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:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, March 24, 2015 7:13 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [llvm] r233153 - 'optnone' should not disable DAG combiner.</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>
<p><br>
On Mar 24, 2015 5:18 PM, "Paul Robinson" <<a href="mailto:paul_robinson@playstation.sony.com" target="_blank">paul_robinson@playstation.sony.com</a>> wrote:<br>
><br>
> Author: probinson<br>
> Date: Tue Mar 24 19:10:24 2015<br>
> New Revision: 233153<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233153&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=233153&view=rev</a><br>
> Log:<br>
> 'optnone' should not disable DAG combiner.<br>
><br>
> Reverts the code change from r221168 and the relevant test.<br>
> It was a mistake to disable the combiner, and based on the ultimate<br>
> definition of 'optnone' we shouldn't have considered the test case<br>
> as failing in the first place.<o:p></o:p></p>
<p>Leave the test case in and switch the expectation (& perhaps add a comment explaining why this the right choice and the previous one wasn't) so there's breadcrumbs if anyone else gets the same idea again in the future?<o:p></o:p></p>
<p>><br>
> Removed:<br>
>     llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll<br>
> Modified:<br>
>     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=233153&r1=233152&r2=233153&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=233153&r1=233152&r2=233153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Mar 24 19:10:24 2015<br>
> @@ -1183,11 +1183,6 @@ void DAGCombiner::Run(CombineLevel AtLev<br>
>    LegalOperations = Level >= AfterLegalizeVectorOps;<br>
>    LegalTypes = Level >= AfterLegalizeTypes;<br>
><br>
> -  // Early exit if this basic block is in an optnone function.<br>
> -  if (DAG.getMachineFunction().getFunction()->hasFnAttribute(<br>
> -          Attribute::OptimizeNone))<br>
> -    return;<br>
> -<br>
>    // Add all the dag nodes to the worklist.<br>
>    for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),<br>
>         E = DAG.allnodes_end(); I != E; ++I)<br>
><br>
> Removed: llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll?rev=233152&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll?rev=233152&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/X86/fastmath-optnone.ll (removed)<br>
> @@ -1,35 +0,0 @@<br>
> -; RUN: llc < %s -mcpu=corei7 -march=x86-64 -mattr=+sse2 | FileCheck %s<br>
> -; Verify that floating-point operations inside 'optnone' functions<br>
> -; are not optimized even if unsafe-fp-math is set.<br>
> -<br>
> -define float @foo(float %x) #0 {<br>
> -entry:<br>
> -  %add = fadd fast float %x, %x<br>
> -  %add1 = fadd fast float %add, %x<br>
> -  ret float %add1<br>
> -}<br>
> -<br>
> -; CHECK-LABEL: @foo<br>
> -; CHECK-NOT: add<br>
> -; CHECK: mul<br>
> -; CHECK-NOT: add<br>
> -; CHECK: ret<br>
> -<br>
> -define float @fooWithOptnone(float %x) #1 {<br>
> -entry:<br>
> -  %add = fadd fast float %x, %x<br>
> -  %add1 = fadd fast float %add, %x<br>
> -  ret float %add1<br>
> -}<br>
> -<br>
> -; CHECK-LABEL: @fooWithOptnone<br>
> -; CHECK-NOT: mul<br>
> -; CHECK: add<br>
> -; CHECK-NOT: mul<br>
> -; CHECK: add<br>
> -; CHECK-NOT: mul<br>
> -; CHECK: ret<br>
> -<br>
> -<br>
> -attributes #0 = { "unsafe-fp-math"="true" }<br>
> -attributes #1 = { noinline optnone "unsafe-fp-math"="true" }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>