From 2210bf6dec4a9868c828af546890805cac353f84 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 6 Nov 2020 08:34:16 +0100 Subject: [PATCH] tree-optimization/97733 - fix SLP of reductions with zero relevant This adds a missing check. 2020-11-06 Richard Biener PR tree-optimization/97733 * tree-vect-slp.c (vect_analyze_slp_instance): If less than two reductions were relevant or live do nothing. --- gcc/tree-vect-slp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 9c63983b625..4d1f17bd3fa 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2539,6 +2539,9 @@ vect_analyze_slp_instance (vec_info *vinfo, if (STMT_VINFO_RELEVANT_P (next_info) || STMT_VINFO_LIVE_P (next_info)) scalar_stmts.quick_push (next_info); + /* If less than two were relevant/live there's nothing to SLP. */ + if (scalar_stmts.length () < 2) + return false; } /* Build the tree for the SLP instance. */ -- 2.30.2