diff options
author | Aditya Kumar <aditya.k7@samsung.com> | 2016-01-21 02:13:52 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2016-01-21 02:13:52 +0000 |
commit | b920a047635c09df188279c02af1499a77e630f7 (patch) | |
tree | 15f7c89c2d1f30f131ebeb04fae4637dee890f41 | |
parent | 8f2252625a841171aad0f7dda84f3811e03c7073 (diff) | |
download | gcc-b920a047635c09df188279c02af1499a77e630f7.zip gcc-b920a047635c09df188279c02af1499a77e630f7.tar.gz gcc-b920a047635c09df188279c02af1499a77e630f7.tar.bz2 |
fix PR68976: only add loop close phi for names defined in loop
* graphite-isl-ast-to-gimple.c: Fix comment.
* graphite-scop-detection.c (defined_in_loop_p): New.
(canonicalize_loop_closed_ssa): Do not add close phi nodes for SSA
names defined in loop.
gcc/testsuite
* gcc.dg/graphite/pr68976.c: New test.
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r232658
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 4 | ||||
-rw-r--r-- | gcc/graphite-scop-detection.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/pr68976.c | 11 |
5 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e5bf1a..c8232bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2016-01-21 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> + * graphite-isl-ast-to-gimple.c: Fix comment. + * graphite-scop-detection.c (defined_in_loop_p): New. + (canonicalize_loop_closed_ssa): Do not add close phi nodes for SSA + names defined in loop. + +2016-01-21 Aditya Kumar <aditya.k7@samsung.com> + Sebastian Pop <s.pop@samsung.com> + * graphite-scop-detection.c (scop_detection::harmful_loop_in_region): Discard unstructured if-then-else regions. diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 6c7fd19..2f2daec 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -507,8 +507,8 @@ private: /* Return the tree variable that corresponds to the given isl ast identifier expression (an isl_ast_expr of type isl_ast_expr_id). - FIXME: We should replace blind conversation of id's type with derivation - of the optimal type when we get the corresponding isl support. Blindly + FIXME: We should replace blind conversion of id's type with derivation + of the optimal type when we get the corresponding isl support. Blindly converting type sizes may be problematic when we switch to smaller types. */ diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 3f268a5..d026d4f 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -336,6 +336,15 @@ make_close_phi_nodes_unique (basic_block bb) } } +/* Return true when NAME is defined in LOOP. */ + +static bool +defined_in_loop_p (tree name, loop_p loop) +{ + gcc_assert (TREE_CODE (name) == SSA_NAME); + return loop == loop_containing_stmt (SSA_NAME_DEF_STMT (name)); +} + /* Transforms LOOP to the canonical loop closed SSA form. */ static void @@ -376,7 +385,9 @@ canonicalize_loop_closed_ssa (loop_p loop) use_operand_p use_p; gphi *close_phi; - if (TREE_CODE (arg) != SSA_NAME) + /* Only add close phi nodes for SSA_NAMEs defined in LOOP. */ + if (TREE_CODE (arg) != SSA_NAME + || !defined_in_loop_p (arg, loop)) continue; close_phi = create_phi_node (NULL_TREE, close); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a2e22f..88774dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-21 Aditya Kumar <aditya.k7@samsung.com> + Sebastian Pop <s.pop@samsung.com> + + * gcc.dg/graphite/pr68976.c: New test. + 2016-01-21 Jakub Jelinek <jakub@redhat.com> PR middle-end/67653 diff --git a/gcc/testsuite/gcc.dg/graphite/pr68976.c b/gcc/testsuite/gcc.dg/graphite/pr68976.c new file mode 100644 index 0000000..ae9bf0f --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr68976.c @@ -0,0 +1,11 @@ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +int kw = -1, hv = -1, ju; +int mc[1]; +void xx(void) +{ + for (; kw; ++kw) + for (; hv; ++hv) + for (ju = 0; ju < 2; ++ju) + mc[kw+1] = mc[0]; +} |