From 77ad31753c0440c4141e957edee243f739570587 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 10 Dec 2015 09:00:58 +0000 Subject: [PATCH] re PR tree-optimization/68806 (internal compiler error: Segmentation fault) 2015-12-10 Richard Biener PR tree-optimization/68806 * tree-vect-loop.c (vect_analyze_loop_2): Properly detect reduction chains and ignore SLP reductions. * gcc.dg/torture/pr68806.c: New testcase. From-SVN: r231493 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr68806.c | 13 +++++++++++++ gcc/tree-vect-loop.c | 9 ++++++--- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr68806.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 856a88f..c990fc3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-12-10 Richard Biener + PR tree-optimization/68806 + * tree-vect-loop.c (vect_analyze_loop_2): Properly detect + reduction chains and ignore SLP reductions. + +2015-12-10 Richard Biener + * tree-if-conv.c (if_convertible_loop_p_1): Do not compute dependences. (if_convertible_loop_p): Adjust. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef7857a..a24de42 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-10 Richard Biener + + PR tree-optimization/68806 + * gcc.dg/torture/pr68806.c: New testcase. + 2015-12-08 Jan Hubicka PR ipa/61886 diff --git a/gcc/testsuite/gcc.dg/torture/pr68806.c b/gcc/testsuite/gcc.dg/torture/pr68806.c new file mode 100644 index 0000000..dbb743b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68806.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +int sad(const unsigned char *p1, long p2) +{ + int a = 0; + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 12; x++) + a += p1[x]; + p1 += p2; + } + return a; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index ee32166..77ad760 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2123,9 +2123,12 @@ again: if (!slp) return false; + /* If there are reduction chains re-trying will fail anyway. */ + if (! LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo).is_empty ()) + return false; + /* Likewise if the grouped loads or stores in the SLP cannot be handled - via interleaving or lane instructions or if there were any SLP - reductions. */ + via interleaving or lane instructions. */ slp_instance instance; slp_tree node; unsigned i, j; @@ -2135,7 +2138,7 @@ again: vinfo = vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (SLP_INSTANCE_TREE (instance))[0]); if (! STMT_VINFO_GROUPED_ACCESS (vinfo)) - return false; + continue; vinfo = vinfo_for_stmt (STMT_VINFO_GROUP_FIRST_ELEMENT (vinfo)); unsigned int size = STMT_VINFO_GROUP_SIZE (vinfo); tree vectype = STMT_VINFO_VECTYPE (vinfo); -- 2.7.4