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
This commit is contained in:
Tobias Grosser 2016-09-08 14:08:05 +00:00
parent adfc971820
commit b316dc166f

View File

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