commit:     29622b090e2889c1d7b592ce76df3f1d11505df6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 13:40:08 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 24 13:40:08 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=29622b09

16.0.0: add IPA ICE fix

Bug: https://gcc.gnu.org/PR123629
Signed-off-by: Sam James <sam <AT> gentoo.org>

 16.0.0/gentoo/88_all_PR123629-ipa.patch | 76 +++++++++++++++++++++++++++++++++
 16.0.0/gentoo/README.history            |  4 ++
 2 files changed, 80 insertions(+)

diff --git a/16.0.0/gentoo/88_all_PR123629-ipa.patch 
b/16.0.0/gentoo/88_all_PR123629-ipa.patch
new file mode 100644
index 0000000..d42c1b6
--- /dev/null
+++ b/16.0.0/gentoo/88_all_PR123629-ipa.patch
@@ -0,0 +1,76 @@
+From 32bd375af7b0aa9bb289a7da636bd4d29c52c47b Mon Sep 17 00:00:00 2001
+Message-ID: 
<32bd375af7b0aa9bb289a7da636bd4d29c52c47b.1771940379.git....@gentoo.org>
+From: Martin Jambor <[email protected]>
+Date: Tue, 24 Feb 2026 11:41:07 +0100
+Subject: [PATCH] ipa: Meet same speculative and certain polymorphic contexts
+ (PR123629)
+
+Hi,
+
+PR 123629 is a somewhat complicated situation.  IPA-CP clones for a
+known speculative polymorphic context in a situation when a caller
+bringing the known context has itself already been cloned, and now we
+can determine that the context coming from that clone is not
+speculative (but otherwise the same).  This confuses the meet function
+of contexts which gives up and returns a useless context, which in
+turn triggers an assert because the value we originally cloned for is
+nowhere to be found in the data structures which describe what we know
+about the function clone.
+
+This patch changes the meet function so that it can deal with this
+situation.  When one of the contexts does not have a certain
+component, the other one is moved to the speculative one.
+
+The patch does not have a testcase, because even though Josef Melcr has
+heroically managed to reduce the original Firefox LTO failure to six
+small files, possibly a lot of work would be needed to make their LTO
+link pass when this is fixed.
+
+The patch has passed bootstrap and testing on x86_64-linux, I have also
+LTO-bootstrapped it with -O3 and profiled-bootstrapped it.
+
+OK for master?
+
+Thanks,
+
+Martin
+
+gcc/ChangeLog:
+
+2026-02-23  Martin Jambor  <[email protected]>
+
+PR ipa/123629
+       * ipa-polymorphic-call.cc
+       (ipa_polymorphic_call_context::meet_with): When an outer context is
+       NULL, call make_speculative on the other one.
+---
+ gcc/ipa-polymorphic-call.cc | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/ipa-polymorphic-call.cc b/gcc/ipa-polymorphic-call.cc
+index 5e53c217e33c..b32dc70806f5 100644
+--- a/gcc/ipa-polymorphic-call.cc
++++ b/gcc/ipa-polymorphic-call.cc
+@@ -2482,12 +2482,14 @@ ipa_polymorphic_call_context::meet_with 
(ipa_polymorphic_call_context ctx,
+       updated = true;
+     }
+ 
+-  /* If call is known to be invalid, we are done.  */
++  /* If a certain context is known to be invalid, we can move to comparing
++     speculation.  Because the second context might be a certain one which can
++     be met with the speculation of the first, make it speculative.  */
+   if (!outer_type)
+-    ;
++    ctx.make_speculative ();
+   else if (!ctx.outer_type)
+     {
+-      clear_outer_type ();
++      make_speculative ();
+       updated = true;
+     }
+   /* If types are known to be same, merging is quite easy.  */
+
+base-commit: a8150eea4e228a387305714554071cf10a6f180f
+-- 
+2.53.0
+

diff --git a/16.0.0/gentoo/README.history b/16.0.0/gentoo/README.history
index ab90f24..050c125 100644
--- a/16.0.0/gentoo/README.history
+++ b/16.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+39     ????
+
+       + 88_all_PR123629-ipa.patch
+
 38     22 February 2026
 
        + 87_all_fix_host_pie.patch

Reply via email to