[llvm] r228988 - Prevent division by 0.
Michael Zolotukhin
mzolotukhin at apple.com
Thu Feb 12 16:38:06 PST 2015
Committed in r228995.
Michael
> On Feb 12, 2015, at 4:24 PM, David Majnemer <david.majnemer at gmail.com> wrote:
>
> Testcase?
>
> On Thu, Feb 12, 2015 at 4:17 PM, Michael Zolotukhin <mzolotukhin at apple.com <mailto:mzolotukhin at apple.com>> wrote:
> Author: mzolotukhin
> Date: Thu Feb 12 18:17:03 2015
> New Revision: 228988
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228988&view=rev <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 <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);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150212/df92541f/attachment.html>
More information about the llvm-commits
mailing list