From bd4298e1927f6c519d5b7829023b1db7e64592e6 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 11 Jan 2021 09:57:41 +0000 Subject: [PATCH] slp: handle externals correctly in linear_loads_p This fixes a bug with externals and linear_loads_p where I forgot to save the value before returning. It also fixes handling of nodes with multiple children on a non VEC_PERM node. There the child iteration would already resolve the kind and the loads are All expected to be the same if valid so just return one. gcc/ChangeLog: * tree-vect-slp-patterns.c (linear_loads_p): Fix externals. --- gcc/tree-vect-slp-patterns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index e30cea1..4bead9a 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -229,6 +229,7 @@ linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root) else if (SLP_TREE_DEF_TYPE (root) != vect_internal_def) { retval.first = PERM_TOP; + perm_cache->put (root, retval); return retval; } @@ -241,6 +242,7 @@ linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root) complex_load_perm_t res = linear_loads_p (perm_cache, child); kind = vect_merge_perms (kind, res.first); /* Unknown and Top are not valid on blends as they produce no permute. */ + retval.first = kind; if (kind == PERM_UNKNOWN || kind == PERM_TOP) return retval; all_loads.safe_push (res.second); @@ -258,7 +260,7 @@ linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root) retval.first = kind; retval.second = nloads; } - else if (all_loads.length () == 1) + else { retval.first = kind; retval.second = all_loads[0]; -- 2.7.4