summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ProfileEstimatorPass.cpp
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
commitc621af1f60f58f31ca65706fe6f893909b0c6260 (patch)
tree8e5f7de9f6b85590cf9d9133164965d2ee65a9d8 /llvm/lib/Analysis/ProfileEstimatorPass.cpp
parentd3511235d1abbf741ad0740af90ce239773c9a60 (diff)
downloadbcm5719-llvm-c621af1f60f58f31ca65706fe6f893909b0c6260.tar.gz
bcm5719-llvm-c621af1f60f58f31ca65706fe6f893909b0c6260.zip
Fix floating-point divide by zero, in a case where the value was not going to be used anyway.
llvm-svn: 162518
Diffstat (limited to 'llvm/lib/Analysis/ProfileEstimatorPass.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileEstimatorPass.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ProfileEstimatorPass.cpp b/llvm/lib/Analysis/ProfileEstimatorPass.cpp
index 63468f84261..12b59e0a6fd 100644
--- a/llvm/lib/Analysis/ProfileEstimatorPass.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud