return -1 when polly::getNumberOfIterations returns -1

llvm-svn: 170422
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index ad70375..8478814 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -770,7 +770,10 @@
 
 int ClastStmtCodeGen::getNumberOfIterations(const clast_for *For) {
   isl_set *LoopDomain = isl_set_copy(isl_set_from_cloog_domain(For->domain));
-  return polly::getNumberOfIterations(LoopDomain) / isl_int_get_si(For->stride) + 1;
+  int NumberOfIterations = polly::getNumberOfIterations(LoopDomain);
+  if (NumberOfIterations == -1)
+    return -1;
+  return NumberOfIterations / isl_int_get_si(For->stride) + 1;
 }
 
 void ClastStmtCodeGen::codegenForVector(const clast_for *F) {