From: Tobias Grosser Date: Thu, 8 Sep 2016 14:08:05 +0000 (+0000) Subject: ScopDetection: Make sure we do not accidentally divide by zero X-Git-Tag: llvmorg-4.0.0-rc1~10332 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b316dc166f8ad41c6d845870e065ded9c1c54399;p=platform%2Fupstream%2Fllvm.git ScopDetection: Make sure we do not accidentally divide by zero This code path is likely never triggered, but by still handling this case locally we avoid warnings in clangs static analyzer. llvm-svn: 280939 --- diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 586beaf..b891c02 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1307,6 +1307,9 @@ bool ScopDetection::hasSufficientCompute(DetectionContext &Context, int NumLoops) const { int InstCount = 0; + if (NumLoops == 0) + return false; + for (auto *BB : Context.CurRegion.blocks()) if (Context.CurRegion.contains(LI->getLoopFor(BB))) InstCount += BB->size();