diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-04 21:38:56 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-04 21:38:56 +0000 |
commit | 48ee8578e049ffdc481875a1c4c7969ff2659805 (patch) | |
tree | 312c10ee2aadf6879aeb8bce6c7a6557c3957526 /gcc | |
parent | 6cfed2d02add41fcefaa2b3711858e6ff81b09d5 (diff) | |
download | gcc-48ee8578e049ffdc481875a1c4c7969ff2659805.tar.gz |
check that all the scev applied ops have are dominated by their defs
2015-12-02 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* gcc.dg/graphite/id-29.c: New test.
gcc/ChangeLog:
2015-12-02 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): Improve debug.
(get_rename_from_scev): Check that all the ops in an expression have their uses dominated by corresponding defs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231310 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 35 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/id-29.c | 17 |
4 files changed, 52 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4223a1ecb5b..0ad4e901e1c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2015-12-04 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> + * graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): + Improve debug. + (get_rename_from_scev): Check that all the ops in an expression + have their uses dominated by corresponding defs. + +2015-12-04 Aditya Kumar <aditya.k7@samsung.com> + Sebastian Pop <s.pop@samsung.com> + PR tree-optimization/68693 * graphite-scop-detection.c (dot_all_sese): New (dot_all_scops_1): Renamed to dot_all_sese. diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 20eb80f52d4..ed2a896f043 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -1116,16 +1116,17 @@ translate_isl_ast_node_user (__isl_keep isl_ast_node *node, build_iv_mapping (iv_map, gbb, user_expr, ip, pbb->scop->scop_info->region); isl_ast_expr_free (user_expr); + basic_block old_bb = GBB_BB (gbb); if (dump_file) { - fprintf (dump_file, "[codegen] copying from basic block\n"); + fprintf (dump_file, + "[codegen] copying from bb_%d on edge (bb_%d, bb_%d)\n", + old_bb->index, next_e->src->index, next_e->dest->index); print_loops_bb (dump_file, GBB_BB (gbb), 0, 3); - fprintf (dump_file, "[codegen] to new basic block\n"); - print_loops_bb (dump_file, next_e->src, 0, 3); + } - next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), next_e, - iv_map); + next_e = copy_bb_and_scalar_dependences (old_bb, next_e, iv_map); iv_map.release (); @@ -1598,8 +1599,8 @@ translate_isl_ast_to_gimple::collect_all_ssa_names (tree new_expr, } } -/* This is abridged version of the function: - tree.c:substitute_in_expr (tree exp, tree f, tree r). */ +/* This is abridged version of the function copied from: + tree.c:substitute_in_expr (tree exp, tree f, tree r). */ static tree substitute_ssa_name (tree exp, tree f, tree r) @@ -1804,15 +1805,23 @@ get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop, } new_expr = rename_all_uses (new_expr, new_bb, old_bb); - /* We should check all the operands and all of them should dominate the use at + + /* We check all the operands and all of them should dominate the use at new_expr. */ - if (TREE_CODE (new_expr) == SSA_NAME) + auto_vec <tree, 2> new_ssa_names; + collect_all_ssa_names (new_expr, &new_ssa_names); + int i; + tree new_ssa_name; + FOR_EACH_VEC_ELT (new_ssa_names, i, new_ssa_name) { - basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (new_expr)); - if (bb && !dominated_by_p (CDI_DOMINATORS, new_bb, bb)) + if (TREE_CODE (new_ssa_name) == SSA_NAME) { - codegen_error = true; - return build_zero_cst (TREE_TYPE (old_name)); + basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (new_ssa_name)); + if (bb && !dominated_by_p (CDI_DOMINATORS, new_bb, bb)) + { + codegen_error = true; + return build_zero_cst (TREE_TYPE (old_name)); + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 312224800be..038c00353dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2015-12-04 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> + * gcc.dg/graphite/id-29.c: New test. + +2015-12-04 Aditya Kumar <aditya.k7@samsung.com> + Sebastian Pop <s.pop@samsung.com> + PR tree-optimization/68693 * gfortran.dg/graphite/pr68693.f90: New test. diff --git a/gcc/testsuite/gcc.dg/graphite/id-29.c b/gcc/testsuite/gcc.dg/graphite/id-29.c new file mode 100644 index 00000000000..9554c0b67d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-29.c @@ -0,0 +1,17 @@ +/* { dg-options "-floop-nest-optimize -O2" } */ + +typedef struct { + unsigned lp, lc; + short *l; + short p[1 << 4]; +} foo; + +void LzmaEnc_Init(foo *p) { + unsigned i; + unsigned num = 0x300 << (p->lp + p->lc); + for (i = 0; i < num; i++) + p->l[i] = ((1 << 11) >> 1); + + for (i = 0; i < (1 << 4); i++) + p->p[i] = ((1 << 11) >> 1); +} |