+2015-10-01 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.
+
2015-10-01 Sebastian Pop <s.pop@samsung.com>
Aditya Kumar <aditya.k7@samsung.com>
static bool
stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt)
{
- data_reference_p dr;
- int j;
- bool res = true;
+ sese region = new_sese (scop.entry, scop.exit);
+ loop_p nest = outermost_loop_in_sese (region, gimple_bb (stmt));
+ loop_p loop = loop_containing_stmt (stmt);
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;
- outer = loop_outer (outer))
+ graphite_find_data_references_in_stmt (nest, loop, stmt, &drs);
+
+ int j;
+ data_reference_p dr;
+ FOR_EACH_VEC_ELT (drs, j, dr)
{
- graphite_find_data_references_in_stmt (outer,
- loop_containing_stmt (stmt),
- stmt, &drs);
+ int nb_subscripts = DR_NUM_DIMENSIONS (dr);
+ tree ref = DR_REF (dr);
- FOR_EACH_VEC_ELT (drs, j, dr)
+ for (int i = nb_subscripts - 1; i >= 0; i--)
{
- int nb_subscripts = DR_NUM_DIMENSIONS (dr);
- tree ref = DR_REF (dr);
-
- for (int i = nb_subscripts - 1; i >= 0; i--)
+ if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
+ || (TREE_CODE (ref) != ARRAY_REF
+ && TREE_CODE (ref) != MEM_REF
+ && TREE_CODE (ref) != COMPONENT_REF))
{
- if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
- || (TREE_CODE (ref) != ARRAY_REF
- && 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);
+ return false;
}
- }
- free_data_refs (drs);
- drs.create (0);
+ ref = TREE_OPERAND (ref, 0);
+ }
}
free_data_refs (drs);
- return res;
+ return true;
}
/* Return true only when STMT is simple enough for being handled by Graphite.
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
information. */
vec<data_reference_p> drs;
drs.create (5);
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;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
if (!bb_in_sese_p (bb, region))
return;
- nest = outermost_loop_in_sese_1 (region, bb);
+ nest = outermost_loop_in_sese (region, bb);
gbb = gbb_from_bb (bb);
FOR_EACH_VEC_ELT (stmts, i, stmt)
/* Returns the outermost loop in SCOP that contains BB. */
struct loop *
-outermost_loop_in_sese (sese region, basic_block bb)
+outermost_loop_in_sese_1 (sese region, basic_block bb)
{
struct loop *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. */
void