public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR tree-optimization/92222 (ice in useless_type_conversion_p, at gimple-expr.c:86)
@ 2020-02-04 21:01 Peter Bergner
  0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 21:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:de819c7eb26504f7752b89db089985c83ac5774c

commit de819c7eb26504f7752b89db089985c83ac5774c
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Nov 27 12:09:36 2019 +0000

    backport: re PR tree-optimization/92222 (ice in useless_type_conversion_p, at gimple-expr.c:86)
    
    2019-11-27  Richard Biener  <rguenther@suse.de>
    
    	Backport from mainline
    	2019-10-25  Richard Biener  <rguenther@suse.de>
    
    	PR tree-optimization/92222
    	* tree-vect-slp.c (_slp_oprnd_info::first_pattern): Remove.
    	(_slp_oprnd_info::second_pattern): Likewise.
    	(_slp_oprnd_info::any_pattern): New.
    	(vect_create_oprnd_info): Adjust.
    	(vect_get_and_check_slp_defs): Compute whether any stmt is
    	in a pattern.
    	(vect_build_slp_tree_2): Avoid building up a node from scalars
    	if any of the operand defs, not just the first, is in a pattern.
    
    	* gcc.dg/torture/pr92222.c: New testcase.
    
    From-SVN: r278763

Diff:
---
 gcc/ChangeLog                          | 15 +++++++++++++++
 gcc/testsuite/ChangeLog                |  8 ++++++++
 gcc/testsuite/gcc.dg/torture/pr92222.c | 17 +++++++++++++++++
 gcc/tree-vect-slp.c                    | 20 ++++++++------------
 4 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b7c5c56..d75b900 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2019-11-27  Richard Biener  <rguenther@suse.de>
+
+	Backport from mainline
+	2019-10-25  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/92222
+	* tree-vect-slp.c (_slp_oprnd_info::first_pattern): Remove.
+	(_slp_oprnd_info::second_pattern): Likewise.
+	(_slp_oprnd_info::any_pattern): New.
+	(vect_create_oprnd_info): Adjust.
+	(vect_get_and_check_slp_defs): Compute whether any stmt is
+	in a pattern.
+	(vect_build_slp_tree_2): Avoid building up a node from scalars
+	if any of the operand defs, not just the first, is in a pattern.
+
 2019-11-21  Jakub Jelinek  <jakub@redhat.com>
 
 	PR tree-optimization/91355
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ec93f8..ef0e593 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-27  Richard Biener  <rguenther@suse.de>
+
+	Backport from mainline
+	2019-10-25  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/92222
+	* gcc.dg/torture/pr92222.c: New testcase.
+
 2019-11-26  Jerry DeLisle  <jvdelisle@gcc.ngu.org>
 
 	Backport from trunk
diff --git a/gcc/testsuite/gcc.dg/torture/pr92222.c b/gcc/testsuite/gcc.dg/torture/pr92222.c
new file mode 100644
index 0000000..f48010d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr92222.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+unsigned char *a;
+int b;
+void f();
+void c()
+{
+  char *d;
+  int e;
+  for (; b; b++) {
+      e = 7;
+      for (; e >= 0; e--)
+	*d++ = a[b] & 1 << e ? '1' : '0';
+  }
+  f();
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 05e1456..2abf480 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -151,8 +151,7 @@ typedef struct _slp_oprnd_info
      stmt.  */
   tree first_op_type;
   enum vect_def_type first_dt;
-  bool first_pattern;
-  bool second_pattern;
+  bool any_pattern;
 } *slp_oprnd_info;
 
 
@@ -172,8 +171,7 @@ vect_create_oprnd_info (int nops, int group_size)
       oprnd_info->def_stmts.create (group_size);
       oprnd_info->first_dt = vect_uninitialized_def;
       oprnd_info->first_op_type = NULL_TREE;
-      oprnd_info->first_pattern = false;
-      oprnd_info->second_pattern = false;
+      oprnd_info->any_pattern = false;
       oprnds_info.quick_push (oprnd_info);
     }
 
@@ -310,13 +308,11 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char *swap,
   tree oprnd;
   unsigned int i, number_of_oprnds;
   enum vect_def_type dt = vect_uninitialized_def;
-  bool pattern = false;
   slp_oprnd_info oprnd_info;
   int first_op_idx = 1;
   unsigned int commutative_op = -1U;
   bool first_op_cond = false;
   bool first = stmt_num == 0;
-  bool second = stmt_num == 1;
 
   if (gcall *stmt = dyn_cast <gcall *> (stmt_info->stmt))
     {
@@ -379,13 +375,12 @@ again:
 	  return -1;
 	}
 
-      if (second)
-	oprnd_info->second_pattern = pattern;
+      if (def_stmt_info && is_pattern_stmt_p (def_stmt_info))
+	oprnd_info->any_pattern = true;
 
       if (first)
 	{
 	  oprnd_info->first_dt = dt;
-	  oprnd_info->first_pattern = pattern;
 	  oprnd_info->first_op_type = TREE_TYPE (oprnd);
 	}
       else
@@ -1228,7 +1223,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
 	      /* ???  Rejecting patterns this way doesn't work.  We'd have to
 		 do extra work to cancel the pattern so the uses see the
 		 scalar version.  */
-	      && !is_pattern_stmt_p (SLP_TREE_SCALAR_STMTS (child)[0]))
+	      && !oprnd_info->any_pattern)
 	    {
 	      slp_tree grandchild;
 
@@ -1272,7 +1267,8 @@ vect_build_slp_tree_2 (vec_info *vinfo,
 	  /* ???  Rejecting patterns this way doesn't work.  We'd have to
 	     do extra work to cancel the pattern so the uses see the
 	     scalar version.  */
-	  && !is_pattern_stmt_p (stmt_info))
+	  && !is_pattern_stmt_p (stmt_info)
+	  && !oprnd_info->any_pattern)
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_NOTE, vect_location,
@@ -1403,7 +1399,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
 		  /* ???  Rejecting patterns this way doesn't work.  We'd have
 		     to do extra work to cancel the pattern so the uses see the
 		     scalar version.  */
-		  && !is_pattern_stmt_p (SLP_TREE_SCALAR_STMTS (child)[0]))
+		  && !oprnd_info->any_pattern)
 		{
 		  unsigned int j;
 		  slp_tree grandchild;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 21:01 [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR tree-optimization/92222 (ice in useless_type_conversion_p, at gimple-expr.c:86) Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).