From: Tom de Vries Date: Tue, 31 May 2016 07:07:26 +0000 (+0000) Subject: Handle 3-arg phi in copy_bb_and_scalar_dependences X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a88cc8467b948a302c9faedded8f39d7bd6380a;p=gcc.git Handle 3-arg phi in copy_bb_and_scalar_dependences 2016-05-31 Tom de Vries PR tree-optimization/69068 * graphite-isl-ast-to-gimple.c (copy_bb_and_scalar_dependences): Handle phis with more than two args. * gcc.dg/graphite/pr69068.c: New test. From-SVN: r236907 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cdcdbcfacc..88fa0e569b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-31 Tom de Vries + + PR tree-optimization/69068 + * graphite-isl-ast-to-gimple.c (copy_bb_and_scalar_dependences): Handle + phis with more than two args. + 2016-05-30 Andreas Tobler * config.gcc: Move hard float support for arm*hf*-*-freebsd* into diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index ff1d91f6266..fb9c8468ebc 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -1075,9 +1075,7 @@ bb_contains_loop_close_phi_nodes (basic_block bb) static bool bb_contains_loop_phi_nodes (basic_block bb) { - gcc_assert (EDGE_COUNT (bb->preds) <= 2); - - if (bb->preds->length () == 1) + if (EDGE_COUNT (bb->preds) != 2) return false; unsigned depth = loop_depth (bb->loop_father); @@ -2480,13 +2478,14 @@ copy_cond_phi_nodes (basic_block bb, basic_block new_bb, vec iv_map) gcc_assert (!bb_contains_loop_close_phi_nodes (bb)); + /* TODO: Handle cond phi nodes with more than 2 predecessors. */ + if (EDGE_COUNT (bb->preds) != 2) + return false; + if (dump_file) fprintf (dump_file, "[codegen] copying cond phi nodes in bb_%d.\n", new_bb->index); - /* Cond phi nodes should have exactly two arguments. */ - gcc_assert (2 == EDGE_COUNT (bb->preds)); - for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dfcd4464b9a..0ae4c9bff9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-31 Tom de Vries + + PR tree-optimization/69068 + * gcc.dg/graphite/pr69068.c: New test. + 2016-05-27 Martin Sebor PR c++/71306 diff --git a/gcc/testsuite/gcc.dg/graphite/pr69068.c b/gcc/testsuite/gcc.dg/graphite/pr69068.c new file mode 100644 index 00000000000..0abea060025 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr69068.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fgraphite-identity" } */ + +int qo; +int zh[2]; + +void +td (void) +{ + int ly, en; + for (ly = 0; ly < 2; ++ly) + for (en = 0; en < 2; ++en) + zh[en] = ((qo == 0) || (((qo * 2) != 0))) ? 1 : -1; +}