[PATCH] Use next_speculative_call_target in get_next_speculative_id

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>
This commit is contained in:
Kugan Vivekanandarajah
2026-03-25 18:25:16 +11:00
parent d95716dac9
commit d7a1a13c72

View 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;