diff options
-rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 5 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index ad703759e8b..84788146f58 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -770,7 +770,10 @@ bool ClastStmtCodeGen::isInnermostLoop(const clast_for *f) { 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) { diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index 90ec0f99b69..2f22d18367e 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -665,7 +665,10 @@ unsigned IslNodeBuilder::getNumberOfIterations(__isl_keep isl_ast_node *For) { isl_union_map *Schedule = isl_ast_build_get_schedule(Info->Context); isl_set *LoopDomain = isl_set_from_union_set(isl_union_map_range(Schedule)); isl_id_free(Annotation); - return polly::getNumberOfIterations(LoopDomain) + 1; + int NumberOfIterations = polly::getNumberOfIterations(LoopDomain); + if (NumberOfIterations == -1) + return -1; + return NumberOfIterations + 1; } void IslNodeBuilder::createUserVector(__isl_take isl_ast_node *User, |