Commit 95ad2417 by Sebastian Pop Committed by Sebastian Pop

call scev analysis in scop-detection as in sese-to-poly

Before our rewrite of the scop detection, we used to not have a valid SESE
region under hand, and so we used to do more ad-hoc analysis of data references
by trying to prove that at all levels of a loop nest the data references would
be still valid.

Now that we have a valid SESE region, we can call the scev analysis in the same
way on the same computed loop nest in the scop-detection as in the sese-to-poly.

Next step will be to cache the data references analyzed in the scop detection
and not compute the same info in sese-to-poly.

The patch fixes block-1.f90 that used to ICE on x86_64-linux when compiled with
-m32.  Patch passed bootstrap with BOOT_CFLAGS="-g -O2 -fgraphite-identity
-floop-nest-optimize" and check on x86_64-linux using ISL-0.15.

2015-09-28  Sebastian Pop  <s.pop@samsung.com>
	Aditya Kumar  <aditya.k7@samsung.com>

	PR tree-optimization/67754
	* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call
	scev analysis on the same loop nest as analyze_drs_in_stmts.
	* graphite-sese-to-poly.c (outermost_loop_in_sese_1): Moved and renamed...
	(try_generate_gimple_bb): Call outermost_loop_in_sese.
	(analyze_drs_in_stmts): Same.
	* sese.c (outermost_loop_in_sese): ...here.

Co-Authored-By: Aditya Kumar <aditya.k7@samsung.com>

From-SVN: r228347
parent cf72400f
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
Aditya Kumar <aditya.k7@samsung.com> Aditya Kumar <aditya.k7@samsung.com>
PR tree-optimization/67754 PR tree-optimization/67754
* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call
scev analysis on the same loop nest as analyze_drs_in_stmts.
* graphite-sese-to-poly.c (outermost_loop_in_sese_1): Moved and renamed...
(try_generate_gimple_bb): Call outermost_loop_in_sese.
(analyze_drs_in_stmts): Same.
* sese.c (outermost_loop_in_sese): ...here.
2015-10-01 Sebastian Pop <s.pop@samsung.com>
Aditya Kumar <aditya.k7@samsung.com>
PR tree-optimization/67754
* graphite-scop-detection.c (loop_body_is_valid_scop): Add missing * graphite-scop-detection.c (loop_body_is_valid_scop): Add missing
recursion on the inner loops. recursion on the inner loops.
...@@ -262,46 +262,37 @@ graphite_can_represent_expr (sese_l scop, loop_p loop, tree expr) ...@@ -262,46 +262,37 @@ graphite_can_represent_expr (sese_l scop, loop_p loop, tree expr)
static bool static bool
stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt) stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt)
{ {
data_reference_p dr; sese region = new_sese (scop.entry, scop.exit);
int j; loop_p nest = outermost_loop_in_sese (region, gimple_bb (stmt));
bool res = true; loop_p loop = loop_containing_stmt (stmt);
vec<data_reference_p> drs = vNULL; vec<data_reference_p> drs = vNULL;
loop_p outer;
loop_p loop_around_scop = get_entry_bb (scop.entry)->loop_father;
for (outer = loop_containing_stmt (stmt); outer && outer != loop_around_scop; graphite_find_data_references_in_stmt (nest, loop, stmt, &drs);
outer = loop_outer (outer))
int j;
data_reference_p dr;
FOR_EACH_VEC_ELT (drs, j, dr)
{ {
graphite_find_data_references_in_stmt (outer, int nb_subscripts = DR_NUM_DIMENSIONS (dr);
loop_containing_stmt (stmt), tree ref = DR_REF (dr);
stmt, &drs);
FOR_EACH_VEC_ELT (drs, j, dr) for (int i = nb_subscripts - 1; i >= 0; i--)
{ {
int nb_subscripts = DR_NUM_DIMENSIONS (dr); if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
tree ref = DR_REF (dr); || (TREE_CODE (ref) != ARRAY_REF
&& TREE_CODE (ref) != MEM_REF
for (int i = nb_subscripts - 1; i >= 0; i--) && TREE_CODE (ref) != COMPONENT_REF))
{ {
if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i)) free_data_refs (drs);
|| (TREE_CODE (ref) != ARRAY_REF return false;
&& TREE_CODE (ref) != MEM_REF
&& TREE_CODE (ref) != COMPONENT_REF))
{
free_data_refs (drs);
return false;
}
ref = TREE_OPERAND (ref, 0);
} }
}
free_data_refs (drs); ref = TREE_OPERAND (ref, 0);
drs.create (0); }
} }
free_data_refs (drs); free_data_refs (drs);
return res; return true;
} }
/* Return true only when STMT is simple enough for being handled by Graphite. /* Return true only when STMT is simple enough for being handled by Graphite.
......
...@@ -274,32 +274,6 @@ free_scops (vec<scop_p> scops) ...@@ -274,32 +274,6 @@ free_scops (vec<scop_p> scops)
scops.release (); scops.release ();
} }
/* 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 /* Generates a polyhedral black box only if the bb contains interesting
information. */ information. */
...@@ -309,7 +283,7 @@ try_generate_gimple_bb (scop_p scop, basic_block bb) ...@@ -309,7 +283,7 @@ try_generate_gimple_bb (scop_p scop, basic_block bb)
vec<data_reference_p> drs; vec<data_reference_p> drs;
drs.create (5); drs.create (5);
sese region = SCOP_REGION (scop); sese region = SCOP_REGION (scop);
loop_p nest = outermost_loop_in_sese_1 (region, bb); loop_p nest = outermost_loop_in_sese (region, bb);
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
...@@ -1934,7 +1908,7 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, vec<gimple *> stmts) ...@@ -1934,7 +1908,7 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, vec<gimple *> stmts)
if (!bb_in_sese_p (bb, region)) if (!bb_in_sese_p (bb, region))
return; return;
nest = outermost_loop_in_sese_1 (region, bb); nest = outermost_loop_in_sese (region, bb);
gbb = gbb_from_bb (bb); gbb = gbb_from_bb (bb);
FOR_EACH_VEC_ELT (stmts, i, stmt) FOR_EACH_VEC_ELT (stmts, i, stmt)
......
...@@ -615,7 +615,7 @@ copy_bb_and_scalar_dependences (basic_block bb, sese region, ...@@ -615,7 +615,7 @@ copy_bb_and_scalar_dependences (basic_block bb, sese region,
/* Returns the outermost loop in SCOP that contains BB. */ /* Returns the outermost loop in SCOP that contains BB. */
struct loop * struct loop *
outermost_loop_in_sese (sese region, basic_block bb) outermost_loop_in_sese_1 (sese region, basic_block bb)
{ {
struct loop *nest; struct loop *nest;
...@@ -627,6 +627,32 @@ outermost_loop_in_sese (sese region, basic_block bb) ...@@ -627,6 +627,32 @@ outermost_loop_in_sese (sese region, basic_block bb)
return nest; return nest;
} }
/* Same as outermost_loop_in_sese_1, 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. */
loop_p
outermost_loop_in_sese (sese region, basic_block bb)
{
loop_p nest = outermost_loop_in_sese_1 (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;
}
/* Sets the false region of an IF_REGION to REGION. */ /* Sets the false region of an IF_REGION to REGION. */
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment