From: Richard Biener Date: Wed, 15 Nov 2023 08:49:31 +0000 (+0100) Subject: Fix ICE with SLP and -fdbg-cnt X-Git-Tag: basepoints/gcc-15~4647 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcef48b59e4b4f86595929b490a8303da1239ac0;p=thirdparty%2Fgcc.git Fix ICE with SLP and -fdbg-cnt We have to clear the visited flag on stmts. * tree-vect-slp.cc (vect_slp_region): Also clear visited flag when we skipped an instance due to -fdbg-cnt. --- diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 80e279d8f506..33c4d1308f61 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -7652,6 +7652,7 @@ vect_slp_region (vec bbs, vec datarefs, bb_vinfo->shared->check_datarefs (); + bool force_clear = false; auto_vec profitable_subgraphs; for (slp_instance instance : BB_VINFO_SLP_INSTANCES (bb_vinfo)) { @@ -7674,15 +7675,17 @@ vect_slp_region (vec bbs, vec datarefs, vect_location = saved_vect_location; if (!dbg_cnt (vect_slp)) - continue; + { + force_clear = true; + continue; + } profitable_subgraphs.safe_push (instance); } /* When we're vectorizing an if-converted loop body make sure we vectorized all if-converted code. */ - if (!profitable_subgraphs.is_empty () - && orig_loop) + if ((!profitable_subgraphs.is_empty () || force_clear) && orig_loop) { gcc_assert (bb_vinfo->bbs.length () == 1); for (gimple_stmt_iterator gsi = gsi_start_bb (bb_vinfo->bbs[0]);