The specific code I'm looking at does not have any function calls. The "lots of FP math" is just a series of FP addition, subtraction and division.<br><br><div class="gmail_quote">On Tue, Aug 6, 2013 at 11:03 AM, David Tweed <span dir="ltr"><<a href="mailto:david.tweed@arm.com" target="_blank">david.tweed@arm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-GB"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I imagine this optimization is for FP math stuff that doesn't involve functions which might set errno (or when we've specified we don't care about that)?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Cheers,<br>
Dave<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US"> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a>] <b>On Behalf Of </b>Chad Rosier<br>
<b>Sent:</b> 06 August 2013 15:46<br><b>To:</b> llvmdev<br><b>Subject:</b> [LLVMdev] Potential SimplifyCFG optimization; hammock to diamond transformation<u></u><u></u></span></p></div><div><div class="h5"><p class="MsoNormal">
<u></u> <u></u></p><p class="MsoNormal">All,<br>I have some code that looks like the following:<br><br>{<br> double a, b, c;<br> for (...) {<br> ...<br> a = lots of FP math;<br> b = lots of FP math;<br> c = lots of FP math;<br>
if (cond) {<br> a = 0.0;<br> b = 0.1;<br> c = 0.2;<br> }<br> ...<br> }<br>}<br><br>Could we not convert the hammock into a diamond and move the initial computation of a, b, and c into the else block. Something like this:<br>
<br>{<br> double a, b, c;<br> for (...) {<br> ...<br> if (cond) {<br> a = 0.0;<br> b = 0.1;<br> c = 0.2;<br> } else {<br> a = lots of FP math;<br> b = lots of FP math;<br> c = lots of FP math;<br>
}<br> ...<br> }<br>}<br><br>Does a similar optimization exist? If not, would the SimplifyCFG pass be an appropriate home for such an optimization?<br><br> Chad<u></u><u></u></p></div></div></div></div></blockquote>
</div><br>