commit:     c3e6bdb5202e2c36fb7806db480631ad57e868c1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 12 09:26:47 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 12 09:26:47 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c3e6bdb5

16.06.0: revert ipa-cp patch

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

 16.0.0/gentoo/87_all_PR123517-ipa-cp-revert.patch | 226 ++++++++++++++++++++++
 16.0.0/gentoo/README.history                      |   1 +
 2 files changed, 227 insertions(+)

diff --git a/16.0.0/gentoo/87_all_PR123517-ipa-cp-revert.patch 
b/16.0.0/gentoo/87_all_PR123517-ipa-cp-revert.patch
new file mode 100644
index 0000000..5dfebcb
--- /dev/null
+++ b/16.0.0/gentoo/87_all_PR123517-ipa-cp-revert.patch
@@ -0,0 +1,226 @@
+From 05fb697e9c2ebb503dbe01c41b86fa01e4a5bec2 Mon Sep 17 00:00:00 2001
+Message-ID: 
<05fb697e9c2ebb503dbe01c41b86fa01e4a5bec2.1768209954.git....@gentoo.org>
+From: Sam James <[email protected]>
+Date: Mon, 12 Jan 2026 09:25:28 +0000
+Subject: [PATCH] Revert "ipa-cp: Use the VR and bits lattices for clones of
+ non-local functions too"
+
+This reverts commit e58b11cd6c9ca3d05752ad84f743a46aa92a6979.
+
+Bug: https://gcc.gnu.org/PR123517
+Bug: https://gcc.gnu.org/PR123543
+---
+ gcc/ipa-cp.cc | 73 ++++++++-------------------------------------------
+ gcc/ipa-cp.h  | 14 ----------
+ 2 files changed, 11 insertions(+), 76 deletions(-)
+
+diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
+index 54f4e4f543c2..769531db193b 100644
+--- a/gcc/ipa-cp.cc
++++ b/gcc/ipa-cp.cc
+@@ -339,25 +339,18 @@ ipcp_print_widest_int (FILE *f, const widest_int &value)
+ void
+ ipcp_bits_lattice::print (FILE *f)
+ {
+-  if (bottom_p ())
+-    {
+-      fprintf (f, "         Bits unusable (BOTTOM)\n");
+-      return;
+-    }
+-
+   if (top_p ())
+-    fprintf (f, "         Bits unknown (TOP)");
++    fprintf (f, "         Bits unknown (TOP)\n");
++  else if (bottom_p ())
++    fprintf (f, "         Bits unusable (BOTTOM)\n");
+   else
+     {
+       fprintf (f, "         Bits: value = ");
+       ipcp_print_widest_int (f, get_value ());
+       fprintf (f, ", mask = ");
+       ipcp_print_widest_int (f, get_mask ());
++      fprintf (f, "\n");
+     }
+-
+-  if (m_recipient_only)
+-    fprintf (f, " (recipient only)");
+-  fprintf (f, "\n");
+ }
+ 
+ /* Print value range lattice to F.  */
+@@ -365,8 +358,6 @@ ipcp_bits_lattice::print (FILE *f)
+ void
+ ipcp_vr_lattice::print (FILE * f)
+ {
+-  if (m_recipient_only)
+-    fprintf (f, "(recipient only) ");
+   m_vr.dump (f);
+ }
+ 
+@@ -897,18 +888,6 @@ ipcp_vr_lattice::set_to_bottom ()
+   return true;
+ }
+ 
+-/* Set the flag that this lattice is a recipient only, return true if it was
+-   not set before.  */
+-
+-bool
+-ipcp_vr_lattice::set_recipient_only ()
+-{
+-  if (m_recipient_only)
+-    return false;
+-  m_recipient_only = true;
+-  return true;
+-}
+-
+ /* Set lattice value to bottom, if it already isn't the case.  */
+ 
+ bool
+@@ -945,18 +924,6 @@ ipcp_bits_lattice::known_nonzero_p () const
+   return wi::ne_p (wi::bit_and (wi::bit_not (m_mask), m_value), 0);
+ }
+ 
+-/* Set the flag that this lattice is a recipient only, return true if it was 
not
+-   set before.  */
+-
+-bool
+-ipcp_bits_lattice::set_recipient_only ()
+-{
+-  if (m_recipient_only)
+-    return false;
+-  m_recipient_only = true;
+-  return true;
+-}
+-
+ /* Convert operand to value, mask form.  */
+ 
+ void
+@@ -1359,28 +1326,17 @@ intersect_argaggs_with (vec<ipa_argagg_value> &elts,
+ }
+ 
+ /* Mark bot aggregate and scalar lattices as containing an unknown variable,
+-   return true is any of them has not been marked as such so far.  If if
+-   MAKE_SIMPLE_RECIPIENTS is true, set the lattices that can only hold one
+-   value to being recipients only, otherwise also set them to bottom.  */
++   return true is any of them has not been marked as such so far.  */
+ 
+ static inline bool
+-set_all_contains_variable (class ipcp_param_lattices *plats,
+-                         bool make_simple_recipients = false)
++set_all_contains_variable (class ipcp_param_lattices *plats)
+ {
+   bool ret;
+   ret = plats->itself.set_contains_variable ();
+   ret |= plats->ctxlat.set_contains_variable ();
+   ret |= set_agg_lats_contain_variable (plats);
+-  if (make_simple_recipients)
+-    {
+-      ret |= plats->bits_lattice.set_recipient_only ();
+-      ret |= plats->m_value_range.set_recipient_only ();
+-    }
+-  else
+-    {
+-      ret |= plats->bits_lattice.set_to_bottom ();
+-      ret |= plats->m_value_range.set_to_bottom ();
+-    }
++  ret |= plats->bits_lattice.set_to_bottom ();
++  ret |= plats->m_value_range.set_to_bottom ();
+   return ret;
+ }
+ 
+@@ -1525,7 +1481,7 @@ initialize_node_lattices (struct cgraph_node *node)
+       {
+         plats->m_value_range.init (type);
+         if (variable)
+-          set_all_contains_variable (plats, true);
++          set_all_contains_variable (plats);
+       }
+     }
+ 
+@@ -2617,8 +2573,7 @@ propagate_bits_across_jump_function (cgraph_edge *cs, 
int idx,
+        result of x & 0xff == 0xff, which gets computed during ccp1 pass
+        and we store it in jump function during analysis stage.  */
+ 
+-      if (!src_lats->bits_lattice.bottom_p ()
+-        || src_lats->bits_lattice.recipient_only_p ())
++      if (!src_lats->bits_lattice.bottom_p ())
+       {
+         if (!op_type)
+           op_type = ipa_get_type (caller_info, src_idx);
+@@ -2684,8 +2639,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, 
ipa_jump_func *jfunc,
+       = ipa_get_parm_lattices (caller_info, src_idx);
+       tree operand_type = ipa_get_type (caller_info, src_idx);
+ 
+-      if (src_lats->m_value_range.bottom_p ()
+-        || src_lats->m_value_range.recipient_only_p ())
++      if (src_lats->m_value_range.bottom_p ())
+       return dest_lat->set_to_bottom ();
+ 
+       if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR
+@@ -6576,11 +6530,6 @@ ipcp_store_vr_results (void)
+       bool do_vr = true;
+       bool do_bits = true;
+ 
+-      /* If the function is not local, the gathered information is only useful
+-       for clones.  */
+-      if (!node->local)
+-      continue;
+-
+       if (!info || !opt_for_fn (node->decl, flag_ipa_vrp))
+       {
+         if (dump_file)
+diff --git a/gcc/ipa-cp.h b/gcc/ipa-cp.h
+index 45da483e9abb..521983d9ad91 100644
+--- a/gcc/ipa-cp.h
++++ b/gcc/ipa-cp.h
+@@ -201,8 +201,6 @@ public:
+   bool set_to_bottom ();
+   bool set_to_constant (widest_int, widest_int);
+   bool known_nonzero_p () const;
+-  bool set_recipient_only ();
+-  bool recipient_only_p () const {return m_recipient_only; }
+ 
+   widest_int get_value () const { return m_value; }
+   widest_int get_mask () const { return m_mask; }
+@@ -218,11 +216,6 @@ private:
+   enum { IPA_BITS_UNDEFINED, IPA_BITS_CONSTANT, IPA_BITS_VARYING }
+     m_lattice_val = IPA_BITS_UNDEFINED;
+ 
+-  /* Set to true if the lattice is valid only as a recipient of propagatad
+-     values but cannot be used as source of propagation because there may be
+-     unknown callers.  */
+-  bool m_recipient_only;
+-
+   /* Similar to ccp_lattice_t, mask represents which bits of value are 
constant.
+      If a bit in mask is set to 0, then the corresponding bit in
+      value is known to be constant.  */
+@@ -238,16 +231,10 @@ class ipcp_vr_lattice
+ {
+ public:
+   value_range m_vr;
+-  /* Set to true if the lattice is valid only as a recipient of propagatad
+-     values but cannot be used as source of propagation because there may be
+-     unknown callers.  */
+-  bool m_recipient_only;
+ 
+   inline bool bottom_p () const;
+   inline bool top_p () const;
+   inline bool set_to_bottom ();
+-  bool set_recipient_only ();
+-  bool recipient_only_p () const {return m_recipient_only; }
+   bool meet_with (const vrange &p_vr);
+   bool meet_with (const ipcp_vr_lattice &other);
+   void init (tree type);
+@@ -264,7 +251,6 @@ ipcp_vr_lattice::init (tree type)
+     m_vr.set_type (type);
+ 
+   // Otherwise m_vr will default to unsupported_range.
+-  m_recipient_only = false;
+ }
+ 
+ /* Structure containing lattices for a parameter itself and for pieces of
+
+base-commit: 3e8ce187dc4595da3d2f41a0fb09ee9cd2e437ff
+-- 
+2.52.0
+

diff --git a/16.0.0/gentoo/README.history b/16.0.0/gentoo/README.history
index 7ad51b2..fe46a58 100644
--- a/16.0.0/gentoo/README.history
+++ b/16.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
 30     ????
 
        - 87_all_PR123383-revert-devirt-ICE.patch
+       + 87_all_PR123517-ipa-cp-revert.patch
 
 29     4 January 2026
 

Reply via email to