]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE with SLP and -fdbg-cnt
authorRichard Biener <rguenther@suse.de>
Wed, 15 Nov 2023 08:49:31 +0000 (09:49 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 15 Nov 2023 12:09:03 +0000 (13:09 +0100)
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.

gcc/tree-vect-slp.cc

index 80e279d8f5067488bc7f78d2e61c6766c7643991..33c4d1308f61f416e0d510e0a787288a4aec28eb 100644 (file)
@@ -7652,6 +7652,7 @@ vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> datarefs,
 
          bb_vinfo->shared->check_datarefs ();
 
+         bool force_clear = false;
          auto_vec<slp_instance> profitable_subgraphs;
          for (slp_instance instance : BB_VINFO_SLP_INSTANCES (bb_vinfo))
            {
@@ -7674,15 +7675,17 @@ vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> 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]);