]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/123986 - upon SLP analysis rollback, release data
authorRichard Biener <rguenther@suse.de>
Thu, 5 Feb 2026 11:26:18 +0000 (12:26 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 5 Feb 2026 12:58:53 +0000 (13:58 +0100)
The following makes sure to release any SLP kind specific data when
rolling back earlier successful analysis.  This avoids crashing
when re-analyzing such node via another graph entry.

PR tree-optimization/123986
* tree-vect-slp.cc (vect_slp_analyze_operations): When
rolling back analyzed nodes, release node specific data
and reset SLP_TREE_TYPE.

gcc/tree-vect-slp.cc

index c481efc749f7ed1499b25e6576f16180494ccdba..c932e8d5cba2d3ce678c33d3541cf7ef5b00684b 100644 (file)
@@ -9258,10 +9258,19 @@ vect_slp_analyze_operations (vec_info *vinfo)
            dump_printf_loc (MSG_NOTE, vect_location,
                             "removing SLP instance operations starting from: %G",
                             stmt_info->stmt);
+         while (!visited_vec.is_empty ())
+           {
+             slp_tree node = visited_vec.pop ();
+             SLP_TREE_TYPE (node) = undef_vec_info_type;
+             if (node->data)
+               {
+                 delete node->data;
+                 node->data = nullptr;
+               }
+             visited.remove (node);
+           }
          vect_free_slp_instance (instance);
           vinfo->slp_instances.ordered_remove (i);
-         while (!visited_vec.is_empty ())
-           visited.remove (visited_vec.pop ());
        }
       else
        {