public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/97886 - deal with strange LC PHI nodes
@ 2020-11-18 10:24 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-11-18 10:24 UTC (permalink / raw)
  To: gcc-patches

This makes vectorization properly assign vector types to PHI
nodes that copy from externals on loop exit edges.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2020-11-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97886
	* tree-vect-loop.c (vectorizable_lc_phi): Properly assign
	vector types to invariants for SLP.
---
 gcc/tree-vect-loop.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index ecaaf0116d3..856bbfebf7c 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7593,6 +7593,17 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo,
 
   if (!vec_stmt) /* transformation not required.  */
     {
+      /* Deal with copies from externs or constants that disguise as
+	 loop-closed PHI nodes (PR97886).  */
+      if (slp_node
+	  && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+						SLP_TREE_VECTYPE (slp_node)))
+	{
+	  if (dump_enabled_p ())
+	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+			     "incompatible vector types for invariants\n");
+	  return false;
+	}
       STMT_VINFO_TYPE (stmt_info) = lc_phi_info_type;
       return true;
     }
-- 
2.26.2

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

only message in thread, other threads:[~2020-11-18 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 10:24 [PATCH] tree-optimization/97886 - deal with strange LC PHI nodes 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).