commit:     ddc48fc0fbe2ed912534bd51afa10d6b9a5cf06c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 14 22:59:06 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 14 22:59:06 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ddc48fc0

15.0.0: update 85_all_PR119614-ipa-vrp-lto.patch

.. and drop incremental patch as it is folded in now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch | 88 ++++++++++++++++++-----
 15.0.0/gentoo/86_all_PR119614-ipa-vrp-lto.patch | 93 -------------------------
 15.0.0/gentoo/README.history                    |  1 -
 3 files changed, 71 insertions(+), 111 deletions(-)

diff --git a/15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch 
b/15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch
index 86fb953..3049a2f 100644
--- a/15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch
+++ b/15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch
@@ -1,4 +1,4 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119614#c27
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119614#c32
 diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
 index 26b1496f29b..9b47c6c364d 100644
 --- a/gcc/ipa-cp.cc
@@ -18,18 +18,19 @@ index 26b1496f29b..9b47c6c364d 100644
        /* Newly expanded artificial thunks do not have lattices.  */
        continue;
 diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
-index 49d68ab044b..d44c360b292 100644
+index 49d68ab044b..eb757658ad7 100644
 --- a/gcc/ipa-prop.cc
 +++ b/gcc/ipa-prop.cc
-@@ -2323,6 +2323,26 @@ ipa_get_value_range (const vrange &tmp)
+@@ -2323,6 +2323,27 @@ ipa_get_value_range (const vrange &tmp)
    return vr;
  }
  
 +/* Read an IPA-VR from IB and DATA_IN.  If it does not contain useful info,
-+   return nullptr. If it is already in the hash of IPA-VRs, return the already
++   return nullptr.  If it is already in the hash of IPA-VRs, return the 
already
 +   present value, otherwise add it to the hash and return this new value.  */
 +
-+ipa_vr *streamer_read_and_hash (lto_input_block *ib, data_in *data_in)
++ipa_vr *
++streamer_read_and_hash (lto_input_block *ib, data_in *data_in)
 +{
 +  ipa_vr ivr;
 +  ivr.streamer_read (ib, data_in);
@@ -48,7 +49,7 @@ index 49d68ab044b..d44c360b292 100644
  /* Assign to JF a pointer to a range just like TMP but either fetch a
     copy from ipa_vr_hash_table or allocate a new on in GC memory.  */
  
-@@ -3312,6 +3332,14 @@ ipa_analyze_node (struct cgraph_node *node)
+@@ -3312,6 +3333,14 @@ ipa_analyze_node (struct cgraph_node *node)
    analysis_dom_walker (&fbi).walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
    disable_ranger (cfun);
  
@@ -63,7 +64,7 @@ index 49d68ab044b..d44c360b292 100644
    ipa_release_body_info (&fbi);
    free_dominance_info (CDI_DOMINATORS);
    pop_cfun ();
-@@ -4793,6 +4821,8 @@ ipa_node_params_t::duplicate(cgraph_node *, cgraph_node 
*,
+@@ -4793,6 +4822,8 @@ ipa_node_params_t::duplicate(cgraph_node *, cgraph_node 
*,
    new_info->known_csts = old_info->known_csts.copy ();
    new_info->known_contexts = old_info->known_contexts.copy ();
  
@@ -72,7 +73,7 @@ index 49d68ab044b..d44c360b292 100644
    new_info->analysis_done = old_info->analysis_done;
    new_info->node_enqueued = old_info->node_enqueued;
    new_info->versionable = old_info->versionable;
-@@ -5272,6 +5302,15 @@ ipa_write_node_info (struct output_block *ob, struct 
cgraph_node *node)
+@@ -5272,6 +5303,15 @@ ipa_write_node_info (struct output_block *ob, struct 
cgraph_node *node)
    streamer_write_uhwi (ob, ipa_get_param_count (info));
    for (j = 0; j < ipa_get_param_count (info); j++)
      streamer_write_uhwi (ob, ipa_get_param_move_cost (info, j));
@@ -88,7 +89,7 @@ index 49d68ab044b..d44c360b292 100644
    bp = bitpack_create (ob->main_stream);
    gcc_assert (info->analysis_done
              || ipa_get_param_count (info) == 0);
-@@ -5407,6 +5446,15 @@ ipa_read_node_info (class lto_input_block *ib, struct 
cgraph_node *node,
+@@ -5407,6 +5447,15 @@ ipa_read_node_info (class lto_input_block *ib, struct 
cgraph_node *node,
      for (k = 0; k < param_count; k++)
        streamer_read_uhwi (ib);
  
@@ -104,16 +105,16 @@ index 49d68ab044b..d44c360b292 100644
    bp = streamer_read_bitpack (ib);
    for (k = 0; k < param_count; k++)
      {
-@@ -6218,7 +6266,7 @@ bool
+@@ -6218,7 +6267,7 @@ bool
  ipa_return_value_range (value_range &range, tree decl)
  {
    cgraph_node *n = cgraph_node::get (decl);
 -  if (!n || !ipa_return_value_sum)
-+  if (!n || (!ipa_return_value_sum))
++  if (!n)
      return false;
    enum availability avail;
    n = n->ultimate_alias_target (&avail);
-@@ -6226,11 +6274,25 @@ ipa_return_value_range (value_range &range, tree decl)
+@@ -6226,11 +6275,24 @@ ipa_return_value_range (value_range &range, tree decl)
      return false;
    if (n->decl != decl && !useless_type_conversion_p (TREE_TYPE (decl), 
TREE_TYPE (n->decl)))
      return false;
@@ -125,8 +126,7 @@ index 49d68ab044b..d44c360b292 100644
 +
 +  if (ipa_return_value_sum)
 +    {
-+      ipa_return_value_summary *v = ipa_return_value_sum->get (n);
-+      if (v)
++      if (ipa_return_value_summary *v = ipa_return_value_sum->get (n))
 +      {
 +        v->vr->get_vrange (range);
 +        return true;
@@ -182,7 +182,7 @@ index 3bd442fff39..8dc8e2f2ab5 100644
  /* From tree-sra.cc:  */
  tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree,
 diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc
-index ac835a435ec..877a9a496cc 100644
+index ac835a435ec..a99e7227528 100644
 --- a/gcc/lto-cgraph.cc
 +++ b/gcc/lto-cgraph.cc
 @@ -44,6 +44,11 @@ along with GCC; see the file COPYING3.  If not see
@@ -197,6 +197,20 @@ index ac835a435ec..877a9a496cc 100644
  
  /* True when asm nodes has been output.  */
  bool asm_nodes_output = false;
+@@ -1992,10 +1997,10 @@ input_offload_tables (bool do_force_output)
+ static int
+ output_cgraph_opt_summary_p (struct cgraph_node *node)
+ {
+-  if (node->clone_of || node->former_clone_of)
+-    return true;
+   clone_info *info = clone_info::get (node);
+-  return info && (info->tree_map || info->param_adjustments);
++  return info && (info->tree_map
++                || info->param_adjustments
++                || info->m_return_vr);
+ }
+ 
+ /* Output optimization summary for EDGE to OB.  */
 @@ -2065,6 +2070,15 @@ output_node_opt_summary (struct output_block *ob,
        stream_write_tree (ob, map->new_tree, true);
        }
@@ -224,7 +238,7 @@ index ac835a435ec..877a9a496cc 100644
      input_edge_opt_summary (e, ib_main);
    for (e = node->indirect_calls; e; e = e->next_callee)
 diff --git a/gcc/symtab-clones.h b/gcc/symtab-clones.h
-index 362bcb63dd1..eb5167d7506 100644
+index 362bcb63dd1..a63036fc94f 100644
 --- a/gcc/symtab-clones.h
 +++ b/gcc/symtab-clones.h
 @@ -21,12 +21,15 @@ along with GCC; see the file COPYING3.  If not see
@@ -240,7 +254,7 @@ index 362bcb63dd1..eb5167d7506 100644
      : tree_map (NULL),
 -      param_adjustments (NULL)
 +      param_adjustments (NULL),
-+    m_return_vr (nullptr)
++      m_return_vr (nullptr)
    {
    }
    /* Constants discovered by IPA-CP, i.e. which parameter should be replaced
@@ -255,3 +269,43 @@ index 362bcb63dd1..eb5167d7506 100644
    /* Return clone_info, if available.  */
    static clone_info *get (cgraph_node *node);
  
+diff --git a/gcc/testsuite/g++.dg/lto/pr119614_0.C 
b/gcc/testsuite/g++.dg/lto/pr119614_0.C
+new file mode 100644
+index 00000000000..09c07fbf566
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/lto/pr119614_0.C
+@@ -0,0 +1,34 @@
++// PR tree-optimization/119614
++// { dg-lto-do link }
++// { dg-lto-options { { -O2 -fPIC -flto -flto-partition=max } } }
++// { dg-require-effective-target shared }
++// { dg-require-effective-target fpic }
++// { dg-require-effective-target musttail }
++// { dg-extra-ld-options "-shared" }
++
++struct S {} b;
++char *foo ();
++int e, g;
++void bar ();
++void corge (S);
++
++[[gnu::noinline]] static char *
++baz ()
++{
++  bar ();
++  return 0;
++}
++
++const char *
++qux ()
++{
++  if (e)
++    {
++      S a = b;
++      corge (a);
++      if (g)
++        return 0;
++      [[gnu::musttail]] return baz ();
++    }
++  return foo ();
++}

diff --git a/15.0.0/gentoo/86_all_PR119614-ipa-vrp-lto.patch 
b/15.0.0/gentoo/86_all_PR119614-ipa-vrp-lto.patch
deleted file mode 100644
index 29715be..0000000
--- a/15.0.0/gentoo/86_all_PR119614-ipa-vrp-lto.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119614#c28
---- a/gcc/symtab-clones.h      2025-04-14 22:51:13.172434417 +0200
-+++ b/gcc/symtab-clones.h      2025-04-14 22:55:11.461235984 +0200
-@@ -29,7 +29,7 @@ struct GTY(()) clone_info
-   clone_info ()
-     : tree_map (NULL),
-       param_adjustments (NULL),
--    m_return_vr (nullptr)
-+      m_return_vr (nullptr)
-   {
-   }
-   /* Constants discovered by IPA-CP, i.e. which parameter should be replaced
---- a/gcc/ipa-prop.cc  2025-04-14 22:51:13.172434417 +0200
-+++ b/gcc/ipa-prop.cc  2025-04-14 22:54:56.094442247 +0200
-@@ -2324,17 +2324,19 @@ ipa_get_value_range (const vrange &tmp)
- }
- 
- /* Read an IPA-VR from IB and DATA_IN.  If it does not contain useful info,
--   return nullptr. If it is already in the hash of IPA-VRs, return the already
-+   return nullptr.  If it is already in the hash of IPA-VRs, return the 
already
-    present value, otherwise add it to the hash and return this new value.  */
- 
--ipa_vr *streamer_read_and_hash (lto_input_block *ib, data_in *data_in)
-+ipa_vr *
-+streamer_read_and_hash (lto_input_block *ib, data_in *data_in)
- {
-   ipa_vr ivr;
-   ivr.streamer_read (ib, data_in);
-   if (ivr.known_p ())
-     {
-       if (!ipa_vr_hash_table)
--      ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
-+      ipa_vr_hash_table
-+        = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
- 
-       value_range tmp;
-       ivr.get_vrange (tmp);
-@@ -6266,7 +6268,7 @@ bool
- ipa_return_value_range (value_range &range, tree decl)
- {
-   cgraph_node *n = cgraph_node::get (decl);
--  if (!n || (!ipa_return_value_sum))
-+  if (!n)
-     return false;
-   enum availability avail;
-   n = n->ultimate_alias_target (&avail);
-@@ -6277,8 +6279,7 @@ ipa_return_value_range (value_range &ran
- 
-   if (ipa_return_value_sum)
-     {
--      ipa_return_value_summary *v = ipa_return_value_sum->get (n);
--      if (v)
-+      if (ipa_return_value_summary *v = ipa_return_value_sum->get (n))
-       {
-         v->vr->get_vrange (range);
-         return true;
---- a/gcc/testsuite/g++.dg/lto/pr119614_0.C    2025-04-14 22:52:58.938014778 
+0200
-+++ b/gcc/testsuite/g++.dg/lto/pr119614_0.C    2025-04-14 22:52:58.938014778 
+0200
-@@ -0,0 +1,34 @@
-+// PR tree-optimization/119614
-+// { dg-lto-do link }
-+// { dg-lto-options { { -O2 -fPIC -flto -flto-partition=max } } }
-+// { dg-require-effective-target shared }
-+// { dg-require-effective-target fpic }
-+// { dg-require-effective-target musttail }
-+// { dg-extra-ld-options "-shared" }
-+
-+struct S {} b;
-+char *foo ();
-+int e, g;
-+void bar ();
-+void corge (S);
-+
-+[[gnu::noinline]] static char *
-+baz ()
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+const char *
-+qux ()
-+{
-+  if (e)
-+    {
-+      S a = b;
-+      corge (a);
-+      if (g)
-+        return 0;
-+      [[gnu::musttail]] return baz ();
-+    }
-+  return foo ();
-+}

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 9297835..8e237f9 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -4,7 +4,6 @@
        - 84_all_PR116975.patch
        + 84_all_PR116975-GDCFLAGS.patch
        + 85_all_PR119614-ipa-vrp-lto.patch
-       + 86_all_PR119614-ipa-vrp-lto-inc.patch
        + 87_all_PR119803-vrp.patch
 
 54     13 April 2025

Reply via email to