From: Richard Biener Date: Tue, 19 Jun 2018 06:53:04 +0000 (+0000) Subject: re PR tree-optimization/86179 (ice in get_later_stmt, at tree-vectorizer.h:1108) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=df0aef6d7e755b5150ddd8fe8fa4209461541cf0;p=gcc.git re PR tree-optimization/86179 (ice in get_later_stmt, at tree-vectorizer.h:1108) 2018-06-19 Richard Biener PR tree-optimization/86179 * tree-vect-patterns.c (vect_pattern_recog_1): Clean up after failed recognition. * gcc.dg/pr86179.c: New testcase. From-SVN: r261731 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 239d08aa6a1..e1b5d2a00b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-19 Richard Biener + + PR tree-optimization/86179 + * tree-vect-patterns.c (vect_pattern_recog_1): Clean up + after failed recognition. + 2018-06-18 Martin Sebor PR middle-end/85602 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3b13226d27..67835408169 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-19 Richard Biener + + PR tree-optimization/86179 + * gcc.dg/pr86179.c: New testcase. + 2018-06-18 Martin Sebor PR middle-end/85602 diff --git a/gcc/testsuite/gcc.dg/pr86179.c b/gcc/testsuite/gcc.dg/pr86179.c new file mode 100644 index 00000000000..6a90f09e6e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86179.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void c(int *d, char *g) +{ + char *a, *b, *e; + int f; + for (; f; f -= 8) { + *d++ = *e++ | (unsigned)*g++ << 8 | (unsigned)*b++ << 16 | + (unsigned)*a++ << 24; + *d++ = *e++ | (unsigned)*g++ << 8 | (unsigned)*b++ << 16 | + (unsigned)*a++ << 24; + } +} diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index c530810aa3e..19d4ea9fb32 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -4496,7 +4496,18 @@ vect_pattern_recog_1 (vect_recog_func *recog_func, stmts_to_replace->quick_push (stmt); pattern_stmt = recog_func->fn (stmts_to_replace, &type_in, &type_out); if (!pattern_stmt) - return false; + { + /* Clear related stmt info that analysis might have noted for + to be replaced stmts. */ + for (i = 0; stmts_to_replace->iterate (i, &stmt) + && (unsigned) i < stmts_to_replace->length (); + i++) + { + stmt_info = vinfo_for_stmt (stmt); + STMT_VINFO_RELATED_STMT (stmt_info) = NULL; + } + return false; + } stmt = stmts_to_replace->last (); stmt_info = vinfo_for_stmt (stmt); @@ -4668,7 +4679,6 @@ vect_pattern_recog (vec_info *vinfo) gimple_stmt_iterator si; unsigned int i, j; auto_vec stmts_to_replace; - gimple *stmt; DUMP_VECT_SCOPE ("vect_pattern_recog"); @@ -4685,6 +4695,10 @@ vect_pattern_recog (vec_info *vinfo) basic_block bb = bbs[i]; for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { + gimple *stmt = gsi_stmt (si); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + if (stmt_info && STMT_VINFO_IN_PATTERN_P (stmt_info)) + continue; /* Scan over all generic vect_recog_xxx_pattern functions. */ for (j = 0; j < NUM_PATTERNS; j++) if (vect_pattern_recog_1 (&vect_vect_recog_func_ptrs[j], si, @@ -4699,9 +4713,11 @@ vect_pattern_recog (vec_info *vinfo) for (si = bb_vinfo->region_begin; gsi_stmt (si) != gsi_stmt (bb_vinfo->region_end); gsi_next (&si)) { - if ((stmt = gsi_stmt (si)) - && vinfo_for_stmt (stmt) - && !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (stmt))) + gimple *stmt = gsi_stmt (si); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + if (stmt_info + && (!STMT_VINFO_VECTORIZABLE (stmt_info) + || STMT_VINFO_IN_PATTERN_P (stmt_info))) continue; /* Scan over all generic vect_recog_xxx_pattern functions. */