From 7c9394e84c54238dd2cf01dfaa06d8e87b39cf95 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Mon, 2 Sep 2024 15:12:58 +0200
Subject: [PATCH] Handle mixing REALPART/IMAGPART with other components in SLP
 groups

The following makes sure we handle a SLP load/store group from
a structure with complex and scalar members.  This for example
happens in gcc.target/i386/pr106010-9a.c.

	* tree-vect-slp.cc (vect_build_slp_tree_1): Handle mixing
	all of handled components besides ARRAY_RANGE_REF, drop
	handling of INDIRECT_REF.
---
 gcc/tree-vect-slp.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 5a65a99d61ed..2302d91fd23f 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1318,13 +1318,15 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
 	       && !(STMT_VINFO_GROUPED_ACCESS (stmt_info)
 		    && (first_stmt_code == ARRAY_REF
 			|| first_stmt_code == BIT_FIELD_REF
-			|| first_stmt_code == INDIRECT_REF
 			|| first_stmt_code == COMPONENT_REF
+			|| first_stmt_code == REALPART_EXPR
+			|| first_stmt_code == IMAGPART_EXPR
 			|| first_stmt_code == MEM_REF)
 		    && (rhs_code == ARRAY_REF
 			|| rhs_code == BIT_FIELD_REF
-			|| rhs_code == INDIRECT_REF
 			|| rhs_code == COMPONENT_REF
+			|| rhs_code == REALPART_EXPR
+			|| rhs_code == IMAGPART_EXPR
 			|| rhs_code == MEM_REF)))
 	      || (ldst_p
 		  && (STMT_VINFO_GROUPED_ACCESS (stmt_info)
-- 
GitLab