From 43fbab6973e5bacb98a78c7f92c9b29b321929ee Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 4 Oct 2012 10:37:38 +0200 Subject: [PATCH] pet_scop_collect_arrays: skip arrays that already appear in scop We already filter out virtual scalars, but in future commits, we may want to introduce non-virtual arrays in the scops during the analysis and then we do not want them to be re-added. Signed-off-by: Sven Verdoolaege --- scop_plus.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scop_plus.cc b/scop_plus.cc index 1fe99f9..13cb26f 100644 --- a/scop_plus.cc +++ b/scop_plus.cc @@ -85,7 +85,8 @@ static void stmt_collect_arrays(struct pet_stmt *stmt, set &arrays) expr_collect_arrays(stmt->body, arrays); } -/* Collect the set of all accessed arrays (or scalars) in "scop" +/* Collect the set of all accessed arrays (or scalars) in "scop", + * except those that already appear in scop->arrays, * and put them in "arrays". */ void pet_scop_collect_arrays(struct pet_scop *scop, set &arrays) @@ -95,4 +96,13 @@ void pet_scop_collect_arrays(struct pet_scop *scop, set &arrays) for (int i = 0; i < scop->n_stmt; ++i) stmt_collect_arrays(scop->stmts[i], arrays); + + for (int i = 0; i < scop->n_array; ++i) { + ValueDecl *decl; + isl_id *id = isl_set_get_tuple_id(scop->arrays[i]->extent); + decl = (ValueDecl *)isl_id_get_user(id); + isl_id_free(id); + + arrays.erase(decl); + } } -- 2.11.4.GIT