summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMatthew Simpson <mssimpso@codeaurora.org>2017-05-16 14:43:55 +0000
committerMatthew Simpson <mssimpso@codeaurora.org>2017-05-16 14:43:55 +0000
commitb7b5d55c389b75ab3bcabbebc4095c082a40db2d (patch)
treeb28e45283aff202d77aa14a26ec1e81fb63608e6 /llvm/lib/Transforms
parentafb555473ee95bbcf9d0524de4c9904b463d1d8e (diff)
downloadbcm5719-llvm-b7b5d55c389b75ab3bcabbebc4095c082a40db2d.tar.gz
bcm5719-llvm-b7b5d55c389b75ab3bcabbebc4095c082a40db2d.zip
[LV] Avoid potentential division by zero when selecting IC
llvm-svn: 303174
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 516ab7d03a8..f18ff8f991f 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6550,8 +6550,8 @@ unsigned LoopVectorizationCostModel::selectInterleaveCount(bool OptForSize,
// We assume that the cost overhead is 1 and we use the cost model
// to estimate the cost of the loop and interleave until the cost of the
// loop overhead is about 5% of the cost of the loop.
- unsigned SmallIC =
- std::min(IC, (unsigned)PowerOf2Floor(SmallLoopCost / LoopCost));
+ unsigned SmallIC = std::min(
+ IC, (unsigned)PowerOf2Floor(SmallLoopCost / LoopCost ? LoopCost : 1));
// Interleave until store/load ports (estimated by max interleave count) are
// saturated.
OpenPOWER on IntegriCloud