[llvm] r228988 - Prevent division by 0.
Michael Zolotukhin
mzolotukhin at apple.com
Thu Feb 12 16:17:03 PST 2015
Author: mzolotukhin
Date: Thu Feb 12 18:17:03 2015
New Revision: 228988
URL: http://llvm.org/viewvc/llvm-project?rev=228988&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=228988&r1=228987&r2=228988&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Feb 12 18:17:03 2015
@@ -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);
More information about the llvm-commits
mailing list