diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2011-01-25 06:48:32 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2011-01-25 06:48:32 +0000 |
commit | 5c640e296a195f791a8ace575c967d7e6f1b69e8 (patch) | |
tree | 161cf05bc35732e9546711884cdfa0e1b5cb902f /gcc/graphite-sese-to-poly.c | |
parent | ac53c0698a1eea50ce05c00d9e7d088c7e43f916 (diff) | |
download | gcc-5c640e296a195f791a8ace575c967d7e6f1b69e8.tar.gz |
Pass to dr_analyze_indices the analysis loop for subscripts.
2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Update
call to graphite_find_data_references_in_stmt.
* graphite-sese-to-poly.c (outermost_loop_in_sese_1): New.
(try_generate_gimple_bb): Call outermost_loop_in_sese_1. Update
call to graphite_find_data_references_in_stmt.
(analyze_drs_in_stmts): Same.
* tree-data-ref.c (dr_analyze_indices): Pass in parameter the loop
in which the scalar analysis of indices is performed.
(create_data_ref): Same. Update call to dr_analyze_indices.
(find_data_references_in_stmt): Update call to create_data_ref.
(graphite_find_data_references_in_stmt): Same.
* tree-data-ref.h (graphite_find_data_references_in_stmt): Update
declaration.
(create_data_ref): Same.
* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Update
call to create_data_ref.
From-SVN: r169218
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r-- | gcc/graphite-sese-to-poly.c | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 3f419c8bc5f..88536fe84af 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -241,6 +241,32 @@ free_scops (VEC (scop_p, heap) *scops) VEC_free (scop_p, heap, scops); } +/* Same as outermost_loop_in_sese, returns the outermost loop + containing BB in REGION, but makes sure that the returned loop + belongs to the REGION, and so this returns the first loop in the + REGION when the loop containing BB does not belong to REGION. */ + +static loop_p +outermost_loop_in_sese_1 (sese region, basic_block bb) +{ + loop_p nest = outermost_loop_in_sese (region, bb); + + if (loop_in_sese_p (nest, region)) + return nest; + + /* When the basic block BB does not belong to a loop in the region, + return the first loop in the region. */ + nest = nest->inner; + while (nest) + if (loop_in_sese_p (nest, region)) + break; + else + nest = nest->next; + + gcc_assert (nest); + return nest; +} + /* Generates a polyhedral black box only if the bb contains interesting information. */ @@ -248,14 +274,23 @@ static gimple_bb_p try_generate_gimple_bb (scop_p scop, basic_block bb) { VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5); - loop_p nest = outermost_loop_in_sese (SCOP_REGION (scop), bb); + sese region = SCOP_REGION (scop); + loop_p nest = outermost_loop_in_sese_1 (region, bb); gimple_stmt_iterator gsi; for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); - if (!is_gimple_debug (stmt)) - graphite_find_data_references_in_stmt (nest, stmt, &drs); + loop_p loop; + + if (is_gimple_debug (stmt)) + continue; + + loop = loop_containing_stmt (stmt); + if (!loop_in_sese_p (loop, region)) + loop = nest; + + graphite_find_data_references_in_stmt (nest, loop, stmt, &drs); } return new_gimple_bb (bb, drs); @@ -2019,17 +2054,28 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, VEC (gimple, heap) *stmts) gimple_bb_p gbb; gimple stmt; int i; + sese region = SCOP_REGION (scop); - if (!bb_in_sese_p (bb, SCOP_REGION (scop))) + if (!bb_in_sese_p (bb, region)) return; - nest = outermost_loop_in_sese (SCOP_REGION (scop), bb); + nest = outermost_loop_in_sese_1 (region, bb); gbb = gbb_from_bb (bb); FOR_EACH_VEC_ELT (gimple, stmts, i, stmt) - if (!is_gimple_debug (stmt)) - graphite_find_data_references_in_stmt (nest, stmt, + { + loop_p loop; + + if (is_gimple_debug (stmt)) + continue; + + loop = loop_containing_stmt (stmt); + if (!loop_in_sese_p (loop, region)) + loop = nest; + + graphite_find_data_references_in_stmt (nest, loop, stmt, &GBB_DATA_REFS (gbb)); + } } /* Insert STMT at the end of the STMTS sequence and then insert the |