[llvm-commits] [llvm] r162518 - /llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp

Ahmed Charles acharles at outlook.com
Fri Aug 24 18:45:58 PDT 2012



> Date: Fri, 24 Aug 2012 00:31:45 +0000
> To: llvm-commits at cs.uiuc.edu
> From: richard-llvm at metafoo.co.uk
> Subject: [llvm-commits] [llvm] r162518 -	/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp
> 
> Author: rsmith
> Date: Thu Aug 23 19:31:45 2012
> New Revision: 162518
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=162518&view=rev
> Log:
> Fix floating-point divide by zero, in a case where the value was not going to be used anyway.
> 
> Modified:
>     llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp
> 
> Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp?rev=162518&r1=162517&r2=162518&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp (original)
> +++ llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Thu Aug 23 19:31:45 2012
> @@ -286,7 +286,7 @@
>      }
>    }
>  
> -  double fraction = floor(BBWeight/Edges.size());
> +  double fraction = Edges.size() ? floor(BBWeight/Edges.size()) : 0.0;

Would it be better to use empty()? Minor detail, yes. :)

>    // Finally we know what flow is still not leaving the block, distribute this
>    // flow onto the empty edges.
>    for (SmallVector<Edge, 8>::iterator ei = Edges.begin(), ee = Edges.end();
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120824/843964b8/attachment.html>


More information about the llvm-commits mailing list