summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-24 00:31:45 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-24 00:31:45 +0000
commit9e085a86376179cd471c3e6a59987339110ff92e (patch)
treeb1763e0b7ef6b203de684a6170c676f71211f16d /lib/Analysis
parent621138679909013143995836c68f76e31e30b666 (diff)
downloadllvm-9e085a86376179cd471c3e6a59987339110ff92e.tar.gz
llvm-9e085a86376179cd471c3e6a59987339110ff92e.tar.bz2
llvm-9e085a86376179cd471c3e6a59987339110ff92e.tar.xz
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ProfileEstimatorPass.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ProfileEstimatorPass.cpp b/lib/Analysis/ProfileEstimatorPass.cpp
index 63468f8426..12b59e0a6f 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<Edge, 8>::iterator ei = Edges.begin(), ee = Edges.end();