From 056cb30d94956568af7987c49878ab4a31274d41 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 3 Jun 2014 09:20:51 +0200 Subject: [PATCH] isl_ast_codegen.c: generate_domain: compute explicit representations of divs The AST generator cannot build an expression from a set if it has any unknown divs. Call isl_set_compute_divs on the guard to ensure that all divs are known. This problem only rarely shows up because explicit representations are usually computed implicitly by the call to isl_ast_build_compute_gist. However, if the build domain is a universe set (which may happen in the case of full unrolling), then this implicit divs computation is not performed. Reported-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- isl_ast_codegen.c | 1 + test_inputs/codegen/unroll7.c | 10 ++++++++++ test_inputs/codegen/unroll7.in | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 test_inputs/codegen/unroll7.c create mode 100644 test_inputs/codegen/unroll7.in diff --git a/isl_ast_codegen.c b/isl_ast_codegen.c index 82213484..b074eba1 100644 --- a/isl_ast_codegen.c +++ b/isl_ast_codegen.c @@ -207,6 +207,7 @@ static int generate_domain(__isl_take isl_map *executed, void *user) return generate_non_single_valued(executed, data); } guard = isl_map_domain(isl_map_copy(map)); + guard = isl_set_compute_divs(guard); guard = isl_set_coalesce(guard); guard = isl_ast_build_compute_gist(data->build, guard); graft = isl_ast_graft_alloc_domain(map, data->build); diff --git a/test_inputs/codegen/unroll7.c b/test_inputs/codegen/unroll7.c new file mode 100644 index 00000000..8392185f --- /dev/null +++ b/test_inputs/codegen/unroll7.c @@ -0,0 +1,10 @@ +{ + S(0, 0); + S(0, 3); + S(0, 4); + S(1, 1); + S(1, 4); + S(2, 2); + S(3, 3); + S(4, 4); +} diff --git a/test_inputs/codegen/unroll7.in b/test_inputs/codegen/unroll7.in new file mode 100644 index 00000000..494e5975 --- /dev/null +++ b/test_inputs/codegen/unroll7.in @@ -0,0 +1,5 @@ +# Check that some code is generated. +# Older versions of isl would abort on unknown divs. +{ S[i,j] -> [i,j]: exists (alpha, beta: j=i+4alpha +3beta and 0 <= alpha < 24 and 0 <= beta and 0 <= i,j < 5) } +{ : } +{ [i,j] -> unroll[x] } -- 2.11.4.GIT