diff options
| author | Michael Zolotukhin <mzolotukhin@apple.com> | 2015-02-13 00:17:03 +0000 |
|---|---|---|
| committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2015-02-13 00:17:03 +0000 |
| commit | 1b4801975136a4257c9317b837a3280833e13673 (patch) | |
| tree | fb58eca083bb699b7e17c805e8545583e6b5e17d /llvm/lib | |
| parent | 186ad60815aacdb0d367a4fcf6eacd68bfe73120 (diff) | |
| download | bcm5719-llvm-1b4801975136a4257c9317b837a3280833e13673.tar.gz bcm5719-llvm-1b4801975136a4257c9317b837a3280833e13673.zip | |
Prevent division by 0.
When we try to estimate number of potentially removed instructions in
loop unroller, we analyze first N iterations and then scale the
computed number by TripCount/N. We should bail out early if N is 0.
llvm-svn: 228988
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 3065b52cef1..a575c457553 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -548,7 +548,7 @@ static unsigned approximateNumberOfOptimizedInstructions(const Loop *L, ScalarEvolution &SE, unsigned TripCount, const TargetTransformInfo &TTI) { - if (!TripCount) + if (!TripCount || !UnrollMaxIterationsCountToAnalyze) return 0; UnrollAnalyzer UA(L, TripCount, SE, TTI); |

