From bc2acf308b433cb1b86bd889df5a23aa3692d141 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 18 May 2012 12:31:54 +0200 Subject: [PATCH] pet_scop_collect_arrays: also collect arrays that only appear in filters Signed-off-by: Sven Verdoolaege --- scop_plus.cc | 4 ++++ tests/filter.c | 9 +++++++++ tests/filter.scop | 31 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/filter.c create mode 100644 tests/filter.scop diff --git a/scop_plus.cc b/scop_plus.cc index a1ace2e..1fe99f9 100644 --- a/scop_plus.cc +++ b/scop_plus.cc @@ -78,6 +78,10 @@ static void stmt_collect_arrays(struct pet_stmt *stmt, set &arrays) { if (!stmt) return; + + for (int i = 0; i < stmt->n_arg; ++i) + expr_collect_arrays(stmt->args[i], arrays); + expr_collect_arrays(stmt->body, arrays); } diff --git a/tests/filter.c b/tests/filter.c new file mode 100644 index 0000000..4391758 --- /dev/null +++ b/tests/filter.c @@ -0,0 +1,9 @@ +void foo(int test[100], int index) +{ + int a; + +#pragma scop + if (test[index]) + a = 5; +#pragma endscop +} diff --git a/tests/filter.scop b/tests/filter.scop new file mode 100644 index 0000000..4533ba7 --- /dev/null +++ b/tests/filter.scop @@ -0,0 +1,31 @@ +context: '{ : }' +arrays: +- context: '{ : }' + extent: '{ test[i0] : i0 >= 0 }' + element_type: int + element_size: 4 +- context: '{ : }' + extent: '{ a[] }' + element_type: int + element_size: 4 +statements: +- line: 7 + domain: '{ [S_1[] -> [test]] : test <= -1 or test >= 1 }' + schedule: '{ S_1[] -> [0] }' + body: + type: binary + operation: = + arguments: + - type: access + relation: '{ S_1[] -> a[] }' + read: 0 + write: 1 + - type: access + relation: '{ S_1[] -> [5] }' + read: 1 + write: 0 + arguments: + - type: access + relation: '[index] -> { S_1[] -> test[index] : index >= 0 or index >= 0 }' + read: 1 + write: 0 -- 2.11.4.GIT