public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR58497 testcase for SPARC
@ 2015-11-11 13:41 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-11-11 13:41 UTC (permalink / raw)
  To: gcc-patches


SPARC doesn't have vector support in this testcase and no integer
multiplication.  The general scalarization support fails to fold
generated stmts so the following just does what other parts of
the lowering do - factor in constants/constructors.

On another note I noticed a tree sharing issue (mitigated by
gimplification).

Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Richard.

2015-11-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/58497
	* tree-vect-generic.c: Include gimplify.h.
	(tree_vec_extract): Lookup constant/constructor DEFs.
	(do_cond): Unshare cond.

Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c	(revision 230146)
+++ gcc/tree-vect-generic.c	(working copy)
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3.
 #include "tree-eh.h"
 #include "gimple-iterator.h"
 #include "gimplify-me.h"
+#include "gimplify.h"
 #include "tree-cfg.h"
 
 
@@ -105,6 +106,15 @@ static inline tree
 tree_vec_extract (gimple_stmt_iterator *gsi, tree type,
 		  tree t, tree bitsize, tree bitpos)
 {
+  if (TREE_CODE (t) == SSA_NAME)
+    {
+      gimple *def_stmt = SSA_NAME_DEF_STMT (t);
+      if (is_gimple_assign (def_stmt)
+	  && (gimple_assign_rhs_code (def_stmt) == VECTOR_CST
+	      || (bitpos
+		  && gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR)))
+	t = gimple_assign_rhs1 (def_stmt);
+    }
   if (bitpos)
     {
       if (TREE_CODE (type) == BOOLEAN_TYPE)
@@ -1419,7 +1429,7 @@ do_cond (gimple_stmt_iterator *gsi, tree
   if (TREE_CODE (TREE_TYPE (b)) == VECTOR_TYPE)
     b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
   tree cond = gimple_assign_rhs1 (gsi_stmt (*gsi));
-  return gimplify_build3 (gsi, code, inner_type, cond, a, b);
+  return gimplify_build3 (gsi, code, inner_type, unshare_expr (cond), a, b);
 }
 
 /* Expand a vector COND_EXPR to scalars, piecewise.  */

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

only message in thread, other threads:[~2015-11-11 13:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 13:41 [PATCH] Fix PR58497 testcase for SPARC Richard Biener

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).