commit: 105e7a429a1b55bdbf23b82f444a1079ea9b8070 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sun Jan 4 22:44:21 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Jan 4 22:44:21 2026 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=105e7a42
16.0.0: revert patch causing crash in IPA devirt Bug: https://gcc.gnu.org/PR123383 Signed-off-by: Sam James <sam <AT> gentoo.org> .../gentoo/87_all_PR123383-revert-devirt-ICE.patch | 97 ++++++++++++++++++++++ 16.0.0/gentoo/README.history | 4 + 2 files changed, 101 insertions(+) diff --git a/16.0.0/gentoo/87_all_PR123383-revert-devirt-ICE.patch b/16.0.0/gentoo/87_all_PR123383-revert-devirt-ICE.patch new file mode 100644 index 0000000..c807ffd --- /dev/null +++ b/16.0.0/gentoo/87_all_PR123383-revert-devirt-ICE.patch @@ -0,0 +1,97 @@ +From b78ca036ed23732d74e42a6fadd08a06e6fdb629 Mon Sep 17 00:00:00 2001 +Message-ID: <b78ca036ed23732d74e42a6fadd08a06e6fdb629.1767566610.git....@gentoo.org> +From: Sam James <[email protected]> +Date: Sun, 4 Jan 2026 22:43:07 +0000 +Subject: [PATCH] Revert "[PATCH] [AutoFDO/devirt] Fix ICE with duplicate + speculative ID" + +This reverts commit 1e314be3ccc50dc7dcf0ad6c3aebe63cf025f4bf. + +Bug: https://gcc.gnu.org/PR123383 +--- + gcc/cgraph.cc | 26 -------------------------- + gcc/cgraph.h | 5 ----- + gcc/ipa-devirt.cc | 5 ++--- + 3 files changed, 2 insertions(+), 34 deletions(-) + +diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc +index 9bca1ac04918..434d8cc99e63 100644 +--- a/gcc/cgraph.cc ++++ b/gcc/cgraph.cc +@@ -1265,32 +1265,6 @@ cgraph_edge::remove (cgraph_edge *edge) + symtab->free_edge (edge); + } + +-/* Returns the next speculative_id based on currently in use +- for the given statement for the edge. +- Returns 0 if no speculative edges exist for this statement. */ +- +-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) +- { +- /* Match the specific GIMPLE statement and check the +- speculative flag */ +- if (e->call_stmt == call_stmt && e->speculative) +- { +- if (e->speculative_id > max_id) +- max_id = e->speculative_id; +- } +- } +- +- return max_id + 1; +-} +- +- + /* Turn edge into speculative call calling N2. Update + the profile so the direct call is taken COUNT times + with FREQUENCY. +diff --git a/gcc/cgraph.h b/gcc/cgraph.h +index 652d045b5711..22b981501e32 100644 +--- a/gcc/cgraph.h ++++ b/gcc/cgraph.h +@@ -1894,11 +1894,6 @@ public: + call. */ + static cgraph_edge *make_direct (cgraph_edge *edge, cgraph_node *callee); + +- /* Returns the next speculative_id based on currently in use +- for the given statement for the edge. +- Returns 0 if no speculative edges exist for this statement. */ +- int get_next_speculative_id (); +- + /* Turn edge into speculative call calling N2. Update + the profile so the direct call is taken COUNT times + with FREQUENCY. speculative_id is used to link direct calls with their +diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc +index a7cb2697813c..08ead43b7ef5 100644 +--- a/gcc/ipa-devirt.cc ++++ b/gcc/ipa-devirt.cc +@@ -3865,7 +3865,7 @@ ipa_devirt (void) + continue; + } + bool first = true; +- unsigned speculative_id = e->get_next_speculative_id (); ++ unsigned speculative_id = 0; + for (cgraph_node * likely_target: likely_targets) + { + if (!devirt_target_ok_p (likely_target, &stats)) +@@ -3940,8 +3940,7 @@ ipa_devirt (void) + + update = true; + e->make_speculative (likely_tgt_node, +- e->count.apply_scale (8, 10), +- e->get_next_speculative_id ()); ++ e->count.apply_scale (8, 10)); + } + } + if (update) + +base-commit: ae06660928877fde3f4fd3e78c257eadc53bd994 +-- +2.52.0 + diff --git a/16.0.0/gentoo/README.history b/16.0.0/gentoo/README.history index 077e5f6..07178b1 100644 --- a/16.0.0/gentoo/README.history +++ b/16.0.0/gentoo/README.history @@ -1,3 +1,7 @@ +29 4 January 2026 + + + 87_all_PR123383-revert-devirt-ICE.patch + 28 21 December 2025 - 86_all_PR122456-pgo-workaround.patch
