From: Richard Smith Date: Fri, 24 Aug 2012 00:31:45 +0000 (+0000) Subject: Fix floating-point divide by zero, in a case where the value was not going to be... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9e085a86376179cd471c3e6a59987339110ff92e;p=oota-llvm.git Fix floating-point divide by zero, in a case where the value was not going to be used anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162518 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ProfileEstimatorPass.cpp b/lib/Analysis/ProfileEstimatorPass.cpp index 63468f84261..12b59e0a6fd 100644 --- a/lib/Analysis/ProfileEstimatorPass.cpp +++ b/lib/Analysis/ProfileEstimatorPass.cpp @@ -286,7 +286,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { } } - double fraction = floor(BBWeight/Edges.size()); + double fraction = Edges.size() ? floor(BBWeight/Edges.size()) : 0.0; // Finally we know what flow is still not leaving the block, distribute this // flow onto the empty edges. for (SmallVector::iterator ei = Edges.begin(), ee = Edges.end();