From c1dc72183bb98b10f123dd16a882c3a517fcc632 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 2 Oct 2013 10:33:31 +0200 Subject: [PATCH] isl_ast_graft_list_extract_hoistable_guard: handle call outside band When we introduce context nodes, we will be calling isl_ast_graft_list_extract_hoistable_guard from outside any band node, meaning that the depth of the current build may point beyond the innermost outer band and we need to handle this possibility. Signed-off-by: Sven Verdoolaege --- isl_ast_graft.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/isl_ast_graft.c b/isl_ast_graft.c index 05009ebb..4b3bd111 100644 --- a/isl_ast_graft.c +++ b/isl_ast_graft.c @@ -114,7 +114,11 @@ static int equal_independent_guards(__isl_keep isl_ast_graft_list *list, return -1; depth = isl_ast_build_get_depth(build); - skip = isl_set_involves_dims(graft_0->guard, isl_dim_set, depth, 1); + if (isl_set_dim(graft_0->guard, isl_dim_set) <= depth) + skip = 0; + else + skip = isl_set_involves_dims(graft_0->guard, + isl_dim_set, depth, 1); if (skip < 0 || skip) { isl_ast_graft_free(graft_0); return skip < 0 ? -1 : 0; -- 2.11.4.GIT