From 96bb56b2d7ee386b29596c59d61b73c5d5d3b7cc Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 13 Jan 2015 12:35:27 +0000 Subject: [PATCH] re PR tree-optimization/64404 (ICE: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1464 with --param=sccvn-max-alias-queries-per-access=1) 2015-01-13 Richard Biener PR tree-optimization/64404 * tree-vect-stmts.c (vectorizable_load): Reject conflicting SLP types for CSEd loads. * gcc.dg/vect/pr64404.c: New testcase. From-SVN: r219527 --- gcc/ChangeLog | 6 +++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/vect/pr64404.c | 59 +++++++++++++++++++++++++++++ gcc/tree-vect-stmts.c | 14 +++++++ 4 files changed, 84 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr64404.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4700629e53f..d99589b2cab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-13 Richard Biener + + PR tree-optimization/64404 + * tree-vect-stmts.c (vectorizable_load): Reject conflicting + SLP types for CSEd loads. + 2015-01-13 Thomas Preud'homme PR tree-optimization/64436 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd4d1d0bdd5..854d5f44611 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Richard Biener + + PR tree-optimization/64404 + * gcc.dg/vect/pr64404.c: New testcase. + 2014-01-13 Richard Biener PR tree-optimization/64568 diff --git a/gcc/testsuite/gcc.dg/vect/pr64404.c b/gcc/testsuite/gcc.dg/vect/pr64404.c new file mode 100644 index 00000000000..aa6463c350b --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr64404.c @@ -0,0 +1,59 @@ +/* { dg-do run } */ +/* { dg-additional-options "--param=sccvn-max-alias-queries-per-access=1" } */ + +#include "tree-vect.h" + +extern void abort (void); + +typedef struct +{ + int l, h; +} tFPinterval; + +tFPinterval X[1024]; +tFPinterval Y[1024]; +tFPinterval Z[1024]; + +void __attribute__((noinline)) +Compute (void) +{ + int d; + for (d = 0; d < 1024; d++) + { + Y[d].l = X[d].l + X[d].h; + Y[d].h = Y[d].l; + Z[d].l = X[d].l; + Z[d].h = X[d].h; + } +} + +int +main (void) +{ + int d; + + check_vect (); + + for (d = 0; d < 1024; d++) + { + X[d].l = d; + X[d].h = d + 1; + __asm__ volatile (""); + } + + Compute (); + + for (d = 0; d < 1024; d++) + { + if (Y[d].l != X[d].l + X[d].h + || Y[d].h != Y[d].l + || Z[d].l != X[d].l + || Z[d].h != X[d].h) + abort (); + __asm__ volatile (""); + } + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 1b79ace08b3..43fc51c8f3e 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5791,6 +5791,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, "group loads with negative dependence distance\n"); return false; } + + /* Similarly when the stmt is a load that is both part of a SLP + instance and a loop vectorized stmt via the same-dr mechanism + we have to give up. */ + if (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info) + && (STMT_SLP_TYPE (stmt_info) + != STMT_SLP_TYPE (vinfo_for_stmt + (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info))))) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "conflicting SLP types for CSEd load\n"); + return false; + } } -- 2.30.2