From 495fa678d44f33a3fe4538911d883b083faaa1f4 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 11 May 2015 14:44:06 +0200 Subject: [PATCH] PetScan::extract: always treat compound statement as a block Now that we have taken care of degrading a block into a sequence of statements if only part of the sequence could be extracted and if this part contains a declaration, we can treat all compound statements as a block at first. Signed-off-by: Sven Verdoolaege --- scan.cc | 6 ++---- tests/autodetect/decl.scop | 26 +++++++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/scan.cc b/scan.cc index 81a9fa8..4ce2105 100644 --- a/scan.cc +++ b/scan.cc @@ -1421,14 +1421,12 @@ __isl_give pet_tree *PetScan::extract_for(ForStmt *stmt) /* Try and construct a pet_tree corresponding to a compound statement. * * "skip_declarations" is set if we should skip initial declarations - * in the children of the compound statements. This then implies - * that this sequence of children should not be treated as a block - * since the initial statements may be skipped. + * in the children of the compound statements. */ __isl_give pet_tree *PetScan::extract(CompoundStmt *stmt, bool skip_declarations) { - return extract(stmt->children(), !skip_declarations, skip_declarations); + return extract(stmt->children(), true, skip_declarations); } /* Return the file offset of the expansion location of "Loc". diff --git a/tests/autodetect/decl.scop b/tests/autodetect/decl.scop index 255fa4b..9226efb 100644 --- a/tests/autodetect/decl.scop +++ b/tests/autodetect/decl.scop @@ -2,16 +2,15 @@ start: 25 end: 53 indent: "\t" context: '{ : }' -schedule: '{ domain: "{ S_3[]; S_0[]; S_2[]; S_1[] }", child: { sequence: [ { filter: - "{ S_0[] }" }, { filter: "{ S_1[] }" }, { filter: "{ S_2[] }" }, { filter: "{ S_3[] - }" } ] } }' +schedule: '{ domain: "{ S_3[]; S_0[]; S_2[]; S_1[]; S_4[] }", child: { sequence: [ + { filter: "{ S_0[] }" }, { filter: "{ S_1[] }" }, { filter: "{ S_2[] }" }, { filter: + "{ S_4[] }" }, { filter: "{ S_3[] }" } ] } }' arrays: - context: '{ : }' extent: '{ c[] }' element_type: int element_size: 4 declared: 1 - exposed: 1 - context: '{ : }' extent: '{ a[] }' element_type: int @@ -65,7 +64,7 @@ statements: - type: int value: 5 - line: 7 - domain: '{ S_3[] }' + domain: '{ S_4[] }' body: type: expression expr: @@ -73,12 +72,25 @@ statements: operation: = arguments: - type: access - index: '{ S_3[] -> b[] }' + index: '{ S_4[] -> b[] }' reference: __pet_ref_3 read: 0 write: 1 - type: access - index: '{ S_3[] -> [(5)] }' + index: '{ S_4[] -> [(5)] }' reference: __pet_ref_4 read: 1 write: 0 +- line: 6 + domain: '{ S_3[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_3[] -> c[] }' + index: '{ S_3[] -> c[] }' + reference: __pet_ref_5 + kill: 1 -- 2.11.4.GIT