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
This commit is contained in:
Michael Zolotukhin 2015-02-13 00:17:03 +00:00
parent 186ad60815
commit 1b48019751
1 changed files with 1 additions and 1 deletions

View File

@ -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);