+2015-10-02 Aditya Kumar <aditya.k7@samsung.com>
+
+ * graphite-scop-detection.c (loop_ivs_can_be_represented): New.
+ (loop_body_is_valid_scop): Call loop_ivs_can_be_represented.
+ * graphite-sese-to-poly.c (new_gimple_bb): Renamed new_gimple_poly_bb.
+ (free_gimple_bb): Renamed free_gimple_poly_bb.
+ (try_generate_gimple_bb): Hoist loop invariant code.
+ (analyze_drs_in_stmts): Same.
+ (build_scop_drs): Call renamed functions.
+ (new_pbb_from_pbb): Same.
+ (scop_ivs_can_be_represented): Delete as functionality now moved to
+ graphite-scop-detection.c
+ (build_poly_scop): Remove call to scop_ivs_can_be_represented.
+
2015-10-02 Aditya Kumar <hiraditya@msn.com>
* graphite-scop-detection.c (stmt_has_side_effects): New function
#endif
}
+/* Can all ivs be represented by a signed integer?
+ As ISL might generate negative values in its expressions, signed loop ivs
+ are required in the backend. */
+
+static bool
+loop_ivs_can_be_represented (loop_p loop)
+{
+ for (gphi_iterator psi = gsi_start_phis (loop->header);
+ !gsi_end_p (psi); gsi_next (&psi))
+ {
+ gphi *phi = psi.phi ();
+ tree res = PHI_RESULT (phi);
+ tree type = TREE_TYPE (res);
+
+ if (TYPE_UNSIGNED (type)
+ && TYPE_PRECISION (type) >= TYPE_PRECISION (long_long_integer_type_node))
+ return false;
+ }
+ return true;
+}
+
/* Return true when the body of LOOP has statements that can be represented as a
valid scop. */
static bool
loop_body_is_valid_scop (loop_p loop, sese_l scop)
{
+ if (!loop_ivs_can_be_represented (loop))
+ {
+ DEBUG_PRINT (dp << "[scop-detection-fail] loop_"
+ << loop->num << "IV cannot be represented.\n");
+ return false;
+ }
+
if (!loop_nest_has_data_refs (loop))
{
DEBUG_PRINT (dp << "[scop-detection-fail] loop_"
/* Store the GRAPHITE representation of BB. */
static gimple_poly_bb_p
-new_gimple_bb (basic_block bb, vec<data_reference_p> drs)
+new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs)
{
gimple_poly_bb_p gbb;
/* Frees GBB. */
static void
-free_gimple_bb (gimple_poly_bb_p gbb)
+free_gimple_poly_bb (gimple_poly_bb_p gbb)
{
free_data_refs_aux (GBB_DATA_REFS (gbb));
free_data_refs (GBB_DATA_REFS (gbb));
poly_bb_p pbb;
FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
- free_gimple_bb (PBB_BLACK_BOX (pbb));
+ free_gimple_poly_bb (PBB_BLACK_BOX (pbb));
}
/* Deletes all scops in SCOPS. */
vec<data_reference_p> drs;
drs.create (5);
sese region = SCOP_REGION (scop);
+
loop_p nest = outermost_loop_in_sese (region, bb);
- gimple_stmt_iterator gsi;
+ loop_p loop = bb->loop_father;
+ if (!loop_in_sese_p (loop, region))
+ loop = nest;
+ gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
- 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);
+ return new_gimple_poly_bb (bb, drs);
}
/* Returns true if all predecessors of BB, that are not dominated by BB, are
for (i = 0; SCOP_BBS (scop).iterate (i, &pbb); i++)
if (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)).is_empty ())
{
- free_gimple_bb (PBB_BLACK_BOX (pbb));
+ free_gimple_poly_bb (PBB_BLACK_BOX (pbb));
free_poly_bb (pbb);
SCOP_BBS (scop).ordered_remove (i);
i--;
return;
nest = outermost_loop_in_sese (region, bb);
+
+ loop_p loop = bb->loop_father;
+ if (!loop_in_sese_p (loop, region))
+ loop = nest;
+
gbb = gbb_from_bb (bb);
FOR_EACH_VEC_ELT (stmts, i, 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));
}
vec<data_reference_p> drs;
drs.create (3);
gimple_poly_bb_p gbb = PBB_BLACK_BOX (pbb);
- gimple_poly_bb_p gbb1 = new_gimple_bb (bb, drs);
+ gimple_poly_bb_p gbb1 = new_gimple_poly_bb (bb, drs);
poly_bb_p pbb1 = new_poly_bb (scop, gbb1);
int index, n = SCOP_BBS (scop).length ();
return res;
}
-/* Can all ivs be represented by a signed integer?
- As ISL might generate negative values in its expressions, signed loop ivs
- are required in the backend. */
-
-static bool
-scop_ivs_can_be_represented (scop_p scop)
-{
- loop_p loop;
- gphi_iterator psi;
- bool result = true;
-
- FOR_EACH_LOOP (loop, 0)
- {
- if (!loop_in_sese_p (loop, SCOP_REGION (scop)))
- continue;
-
- for (psi = gsi_start_phis (loop->header);
- !gsi_end_p (psi); gsi_next (&psi))
- {
- gphi *phi = psi.phi ();
- tree res = PHI_RESULT (phi);
- tree type = TREE_TYPE (res);
-
- if (TYPE_UNSIGNED (type)
- && TYPE_PRECISION (type) >= TYPE_PRECISION (long_long_integer_type_node))
- {
- result = false;
- break;
- }
- }
- if (!result)
- break;
- }
-
- return result;
-}
-
/* Builds the polyhedral representation for a SESE region. */
void
if (nb_pbbs_in_loops (scop) == 0)
return;
- if (!scop_ivs_can_be_represented (scop))
- return;
-
build_sese_loop_nests (region);
/* Record all conditions in REGION. */
sese_dom_walker (CDI_DOMINATORS, region).walk (cfun->cfg->x_entry_block_ptr);