From 95ad24179723a91622852711b74ee3dd95657ffe Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 1 Oct 2015 15:17:58 +0000 Subject: 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 Aditya Kumar 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 From-SVN: r228347 --- gcc/graphite-scop-detection.c | 49 ++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) (limited to 'gcc/graphite-scop-detection.c') diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index d95f527..c45df55 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -262,46 +262,37 @@ graphite_can_represent_expr (sese_l scop, loop_p loop, tree expr) 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 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. -- cgit v1.1