<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br><br><div><div id="SkyDrivePlaceholder"></div>> Date: Fri, 24 Aug 2012 00:31:45 +0000<br>> To: llvm-commits@cs.uiuc.edu<br>> From: richard-llvm@metafoo.co.uk<br>> Subject: [llvm-commits] [llvm] r162518 - /llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp<br>> <br>> Author: rsmith<br>> Date: Thu Aug 23 19:31:45 2012<br>> New Revision: 162518<br>> <br>> URL: http://llvm.org/viewvc/llvm-project?rev=162518&view=rev<br>> Log:<br>> Fix floating-point divide by zero, in a case where the value was not going to be used anyway.<br>> <br>> Modified:<br>>     llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp<br>> <br>> Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp<br>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp?rev=162518&r1=162517&r2=162518&view=diff<br>> ==============================================================================<br>> --- llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp (original)<br>> +++ llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Thu Aug 23 19:31:45 2012<br>> @@ -286,7 +286,7 @@<br>>      }<br>>    }<br>>  <br>> -  double fraction = floor(BBWeight/Edges.size());<br>> +  double fraction = Edges.size() ? floor(BBWeight/Edges.size()) : 0.0;<br><br>Would it be better to use empty()? Minor detail, yes. :)<br><br>>    // Finally we know what flow is still not leaving the block, distribute this<br>>    // flow onto the empty edges.<br>>    for (SmallVector<Edge, 8>::iterator ei = Edges.begin(), ee = Edges.end();<br>> <br>> <br>> _______________________________________________<br>> llvm-commits mailing list<br>> llvm-commits@cs.uiuc.edu<br>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div>                                       </div></body>
</html>