diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 3065b52cef1f..a575c457553f 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);