]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] Use next_speculative_call_target in get_next_speculative_id
authorKugan Vivekanandarajah <kvivekananda@nvidia.com>
Wed, 25 Mar 2026 07:25:16 +0000 (18:25 +1100)
committerKugan Vivekanandarajah <kvivekananda@nvidia.com>
Wed, 25 Mar 2026 07:25:16 +0000 (18:25 +1100)
This patch uses next_speculative_call_target in get_next_speculative_id
As the specualtive_id should be unique only within on speculative id
block.

gcc/ChangeLog:

* cgraph.cc (cgraph_edge::get_next_speculative_id): Use
next_speculative_call_target in get_next_speculative_id.

Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
gcc/cgraph.cc

index 508a5559569d33a31d18adb25487697138d44ce6..90635fb5a89da78a305347f1380ada6707b4ed6d 100644 (file)
@@ -1273,20 +1273,19 @@ int
 cgraph_edge::get_next_speculative_id ()
 {
   int max_id = -1;
-  cgraph_edge *e;
 
-  /* Iterate through all edges leaving this caller */
-  for (e = caller->callees; e; e = e->next_callee)
+  /* If this edge is not yet speculative, there are no existing speculative
+     edges for this call site, so return 0.  */
+  if (!speculative)
+    return 0;
+
+  /* Iterate only through speculative edges for this specific call site.  */
+  for (cgraph_edge *e = first_speculative_call_target ();
+       e;
+       e = e->next_speculative_call_target ())
     {
-      /* Match the specific GIMPLE statement and check the
-        speculative flag */
-      if (e->call_stmt == call_stmt
-         && e->lto_stmt_uid == lto_stmt_uid
-         && e->speculative)
-       {
-         if (e->speculative_id > max_id)
-           max_id = e->speculative_id;
-       }
+      if (e->speculative_id > max_id)
+       max_id = e->speculative_id;
     }
 
   return max_id + 1;