From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
Date: Mon, 14 Apr 2025 20:51:54 +0000 (UTC) [thread overview]
Message-ID: <1744663902.146716b7b6b50240e891d78bab4eac96e0eb21a2.sam@gentoo> (raw)
commit: 146716b7b6b50240e891d78bab4eac96e0eb21a2
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 14 20:51:42 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 14 20:51:42 2025 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=146716b7
15.0.0: add 85_all_PR119614-ipa-vrp-lto.patch
Hopefully fixes protobuf with LTO.
Signed-off-by: Sam James <sam <AT> gentoo.org>
15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch | 257 ++++++++++++++++++++++++
1 file changed, 257 insertions(+)
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
new file mode 100644
index 0000000..86fb953
--- /dev/null
+++ b/15.0.0/gentoo/85_all_PR119614-ipa-vrp-lto.patch
@@ -0,0 +1,257 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119614#c27
+diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
+index 26b1496f29b..9b47c6c364d 100644
+--- a/gcc/ipa-cp.cc
++++ b/gcc/ipa-cp.cc
+@@ -6334,6 +6334,13 @@ ipcp_store_vr_results (void)
+
+ if (info->ipcp_orig_node)
+ info = ipa_node_params_sum->get (info->ipcp_orig_node);
++
++ if (do_vr && info->m_return_vr)
++ {
++ clone_info *clone_info = clone_info::get_create (node);
++ clone_info->m_return_vr = info->m_return_vr;
++ }
++
+ if (info->lattices.is_empty ())
+ /* 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
+--- a/gcc/ipa-prop.cc
++++ b/gcc/ipa-prop.cc
+@@ -2323,6 +2323,26 @@ 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
++ 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 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);
++
++ value_range tmp;
++ ivr.get_vrange (tmp);
++ return ipa_get_value_range (tmp);
++ }
++ return nullptr;
++}
++
+ /* 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)
+ analysis_dom_walker (&fbi).walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ disable_ranger (cfun);
+
++ ipa_return_value_summary *rvs;
++
++ if (ipa_return_value_sum
++ && (rvs = ipa_return_value_sum->get (node)))
++ /* The VRs in the summary already live in the cache, no need to go through
++ ipa_get_value_range. */
++ info->m_return_vr = rvs->vr;
++
+ 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 *,
+ new_info->known_csts = old_info->known_csts.copy ();
+ new_info->known_contexts = old_info->known_contexts.copy ();
+
++ new_info->m_return_vr = old_info->m_return_vr;
++
+ 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)
+ 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));
++ if (info->m_return_vr)
++ info->m_return_vr->streamer_write (ob);
++ else
++ {
++ bp = bitpack_create (ob->main_stream);
++ bp_pack_value (&bp, false, 1);
++ streamer_write_bitpack (&bp);
++ }
++
+ 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,
+ for (k = 0; k < param_count; k++)
+ streamer_read_uhwi (ib);
+
++ ipa_vr rvr;
++ rvr.streamer_read (ib, data_in);
++ if (prevails && rvr.known_p ())
++ {
++ value_range tmp;
++ rvr.get_vrange (tmp);
++ info->m_return_vr = ipa_get_value_range (tmp);
++ }
++
+ bp = streamer_read_bitpack (ib);
+ for (k = 0; k < param_count; k++)
+ {
+@@ -6218,7 +6266,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))
+ return false;
+ enum availability avail;
+ n = n->ultimate_alias_target (&avail);
+@@ -6226,11 +6274,25 @@ 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;
+- ipa_return_value_summary *v = ipa_return_value_sum->get (n);
+- if (!v)
+- return false;
+- v->vr->get_vrange (range);
+- return true;
++
++ if (ipa_return_value_sum)
++ {
++ ipa_return_value_summary *v = ipa_return_value_sum->get (n);
++ if (v)
++ {
++ v->vr->get_vrange (range);
++ return true;
++ }
++ }
++
++ clone_info *info = clone_info::get (n);
++ if (info && info->m_return_vr)
++ {
++ gcc_assert (info->m_return_vr->known_p ());
++ info->m_return_vr->get_vrange (range);
++ return true;
++ }
++ return false;
+ }
+
+ /* Reset all state within ipa-prop.cc so that we can rerun the compiler
+diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
+index 3bd442fff39..8dc8e2f2ab5 100644
+--- a/gcc/ipa-prop.h
++++ b/gcc/ipa-prop.h
+@@ -653,6 +653,9 @@ public:
+ /* If this node is an ipa-cp clone, these are the known polymorphic contexts
+ that describe what it has been specialized for. */
+ vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts;
++ /* If non-NULL, the known value range of the return value of this
++ function. */
++ class ipa_vr *m_return_vr;
+ /* Whether the param uses analysis and jump function computation has already
+ been performed. */
+ unsigned analysis_done : 1;
+@@ -679,10 +682,10 @@ public:
+ inline
+ ipa_node_params::ipa_node_params ()
+ : descriptors (NULL), lattices (vNULL), ipcp_orig_node (NULL),
+- known_csts (vNULL), known_contexts (vNULL), analysis_done (0),
+- node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0),
+- node_dead (0), node_within_scc (0), node_is_self_scc (0),
+- node_calling_single_call (0), versionable (0)
++ known_csts (vNULL), known_contexts (vNULL), m_return_vr (nullptr),
++ analysis_done (0), node_enqueued (0), do_clone_for_all_contexts (0),
++ is_all_contexts_clone (0), node_dead (0), node_within_scc (0),
++ node_is_self_scc (0), node_calling_single_call (0), versionable (0)
+ {
+ }
+
+@@ -1275,6 +1278,7 @@ bool unadjusted_ptr_and_unit_offset (tree op, tree *ret,
+ poly_int64 *offset_ret);
+ void ipa_get_range_from_ip_invariant (vrange &r, tree val, cgraph_node *node);
+ void ipa_prop_cc_finalize (void);
++ipa_vr *streamer_read_and_hash (lto_input_block *ib, data_in *data_in);
+
+ /* 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
+--- a/gcc/lto-cgraph.cc
++++ b/gcc/lto-cgraph.cc
+@@ -44,6 +44,11 @@ along with GCC; see the file COPYING3. If not see
+ #include "symbol-summary.h"
+ #include "symtab-thunks.h"
+ #include "symtab-clones.h"
++#include "sreal.h"
++#include "value-range.h"
++#include "value-range-storage.h"
++#include "ipa-cp.h"
++#include "ipa-prop.h"
+
+ /* True when asm nodes has been output. */
+ bool asm_nodes_output = false;
+@@ -2065,6 +2070,15 @@ output_node_opt_summary (struct output_block *ob,
+ stream_write_tree (ob, map->new_tree, true);
+ }
+
++ if (info && info->m_return_vr)
++ info->m_return_vr->streamer_write (ob);
++ else
++ {
++ bp = bitpack_create (ob->main_stream);
++ bp_pack_value (&bp, false, 1);
++ streamer_write_bitpack (&bp);
++ }
++
+ if (lto_symtab_encoder_in_partition_p (encoder, node))
+ {
+ for (e = node->callees; e; e = e->next_callee)
+@@ -2181,6 +2195,9 @@ input_node_opt_summary (struct cgraph_node *node,
+ map->parm_num = streamer_read_uhwi (ib_main);
+ map->new_tree = stream_read_tree (ib_main, data_in);
+ }
++
++ info->m_return_vr = streamer_read_and_hash (ib_main, data_in);
++
+ for (e = node->callees; e; e = e->next_callee)
+ 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
+--- a/gcc/symtab-clones.h
++++ b/gcc/symtab-clones.h
+@@ -21,12 +21,15 @@ along with GCC; see the file COPYING3. If not see
+ #ifndef GCC_SYMTAB_CLONES_H
+ #define GCC_SYMTAB_CLONES_H
+
++class ipa_vr;
++
+ struct GTY(()) clone_info
+ {
+ /* Constructor. */
+ clone_info ()
+ : tree_map (NULL),
+- param_adjustments (NULL)
++ param_adjustments (NULL),
++ m_return_vr (nullptr)
+ {
+ }
+ /* Constants discovered by IPA-CP, i.e. which parameter should be replaced
+@@ -35,6 +38,10 @@ struct GTY(()) clone_info
+ /* Parameter modification that IPA-SRA decided to perform. */
+ ipa_param_adjustments *param_adjustments;
+
++ /* If non-NULL, the known value range of the return value of this
++ function. */
++ ipa_vr *m_return_vr;
++
+ /* Return clone_info, if available. */
+ static clone_info *get (cgraph_node *node);
+
next reply other threads:[~2025-04-14 20:51 UTC|newest]
Thread overview: 224+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 20:51 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-04-18 19:21 [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ Sam James
2025-04-16 13:30 Sam James
2025-04-16 10:04 Sam James
2025-04-16 9:58 Sam James
2025-04-15 21:09 Sam James
2025-04-15 16:40 Sam James
2025-04-14 22:59 Sam James
2025-04-14 22:47 Sam James
2025-04-14 22:44 Sam James
2025-04-14 21:06 Sam James
2025-04-14 16:08 Sam James
2025-04-14 16:08 Sam James
2025-04-13 22:54 Sam James
2025-04-10 21:59 Sam James
2025-04-10 9:08 Sam James
2025-04-09 15:27 Sam James
2025-04-09 13:27 Sam James
2025-04-09 12:42 Sam James
2025-04-07 18:02 Sam James
2025-04-07 7:07 Sam James
2025-04-07 6:54 Sam James
2025-04-06 23:08 Sam James
2025-04-05 15:33 Sam James
2025-04-05 8:02 Sam James
2025-04-05 1:43 Sam James
2025-04-04 19:06 Sam James
2025-04-02 18:48 Sam James
2025-04-02 18:03 Sam James
2025-04-02 16:14 Sam James
2025-04-02 13:56 Sam James
2025-04-02 4:59 Sam James
2025-04-01 14:46 Sam James
2025-04-01 14:46 Sam James
2025-03-31 22:16 Sam James
2025-03-31 22:03 Sam James
2025-03-31 4:05 Sam James
2025-03-29 20:31 Sam James
2025-03-29 14:33 Sam James
2025-03-29 13:51 Sam James
2025-03-26 6:25 Sam James
2025-03-25 10:27 Sam James
2025-03-25 8:38 Sam James
2025-03-25 2:32 Sam James
2025-03-25 1:27 Sam James
2025-03-24 0:35 Sam James
2025-03-21 19:31 Sam James
2025-03-21 17:21 Sam James
2025-03-21 16:23 Sam James
2025-03-21 11:20 Sam James
2025-03-21 8:51 Sam James
2025-03-21 6:07 Sam James
2025-03-20 22:08 Sam James
2025-03-20 1:59 Sam James
2025-03-20 1:59 Sam James
2025-03-16 22:37 Sam James
2025-03-14 14:46 Sam James
2025-03-14 13:37 Sam James
2025-03-13 16:48 Sam James
2025-03-13 10:08 Sam James
2025-03-11 10:32 Sam James
2025-03-07 16:54 Sam James
2025-03-03 16:38 Sam James
2025-03-01 10:33 Sam James
2025-03-01 6:50 Sam James
2025-02-17 1:30 Sam James
2025-02-13 9:23 Sam James
2025-02-12 15:12 Sam James
2025-02-10 21:22 Sam James
2025-02-09 23:58 Sam James
2025-02-07 23:37 Sam James
2025-02-07 21:19 Sam James
2025-02-03 22:04 Sam James
2025-02-02 22:41 Sam James
2025-01-29 20:21 Sam James
2025-01-26 22:52 Sam James
2025-01-22 16:27 Sam James
2025-01-19 22:43 Sam James
2025-01-16 23:11 Sam James
2025-01-16 23:11 Sam James
2025-01-15 11:41 Sam James
2025-01-14 16:22 Sam James
2025-01-14 15:06 Sam James
2025-01-14 15:06 Sam James
2025-01-14 12:29 Sam James
2025-01-14 8:43 Sam James
2025-01-14 8:40 Sam James
2025-01-13 13:58 Sam James
2025-01-13 6:00 Sam James
2025-01-13 3:40 Sam James
2025-01-13 3:23 Sam James
2025-01-13 3:20 Sam James
2025-01-13 0:20 Sam James
2025-01-12 18:53 Sam James
2025-01-11 12:53 Sam James
2025-01-08 21:51 Sam James
2025-01-06 10:50 Sam James
2025-01-06 10:03 Sam James
2025-01-06 4:49 Sam James
2025-01-06 4:44 Sam James
2025-01-06 4:13 Sam James
2025-01-06 4:13 Sam James
2025-01-06 4:13 Sam James
2025-01-06 4:03 Sam James
2025-01-05 23:19 Sam James
2025-01-03 3:07 Sam James
2024-12-30 1:05 Sam James
2024-12-29 10:00 Sam James
2024-12-27 15:14 Sam James
2024-12-24 20:48 Sam James
2024-12-22 22:46 Sam James
2024-12-20 11:25 Sam James
2024-12-20 5:57 Sam James
2024-12-20 1:55 Sam James
2024-12-19 18:34 Sam James
2024-12-13 13:23 Sam James
2024-12-13 11:52 Sam James
2024-12-13 5:08 Sam James
2024-12-12 12:28 Sam James
2024-12-11 4:41 Sam James
2024-12-11 0:58 Sam James
2024-12-10 19:19 Sam James
2024-12-10 14:55 Sam James
2024-12-10 5:19 Sam James
2024-12-10 5:13 Sam James
2024-12-10 5:11 Sam James
2024-12-10 5:07 Sam James
2024-12-09 3:05 Sam James
2024-12-08 22:41 Sam James
2024-12-06 17:33 Sam James
2024-12-04 20:40 Sam James
2024-12-01 22:51 Sam James
2024-12-01 22:51 Sam James
2024-11-30 11:30 Sam James
2024-11-27 17:42 Sam James
2024-11-25 15:10 Sam James
2024-11-25 3:01 Sam James
2024-11-25 3:00 Sam James
2024-11-25 3:00 Sam James
2024-11-24 22:42 Sam James
2024-11-18 17:25 Sam James
2024-11-18 10:42 Sam James
2024-11-18 10:42 Sam James
2024-11-18 9:25 Sam James
2024-11-18 9:25 Sam James
2024-11-14 18:38 Sam James
2024-11-13 4:26 Sam James
2024-11-13 0:16 Sam James
2024-11-12 2:33 Sam James
2024-11-11 19:46 Sam James
2024-11-11 19:46 Sam James
2024-11-10 22:41 Sam James
2024-11-09 16:24 Sam James
2024-11-09 7:55 Sam James
2024-11-08 8:22 Sam James
2024-11-07 16:13 Sam James
2024-11-03 23:16 Sam James
2024-11-01 8:24 Sam James
2024-11-01 8:24 Sam James
2024-11-01 8:18 Sam James
2024-11-01 8:17 Sam James
2024-10-30 16:03 Sam James
2024-10-29 19:17 Sam James
2024-10-28 21:32 Sam James
2024-10-28 8:09 Sam James
2024-10-23 15:40 Sam James
2024-10-22 19:09 Sam James
2024-10-22 18:34 Sam James
2024-10-21 12:33 Sam James
2024-10-21 12:27 Sam James
2024-10-21 12:26 Sam James
2024-10-21 11:45 Sam James
2024-10-20 22:42 Sam James
2024-10-18 14:05 Sam James
2024-10-18 10:35 Sam James
2024-10-17 23:33 Sam James
2024-10-17 23:03 Sam James
2024-10-17 5:01 Sam James
2024-10-17 4:15 Sam James
2024-10-13 22:48 Sam James
2024-10-07 2:45 Sam James
2024-10-04 10:37 Sam James
2024-10-04 9:28 Sam James
2024-10-02 19:45 Sam James
2024-09-30 14:05 Sam James
2024-09-29 22:56 Sam James
2024-09-24 1:41 Sam James
2024-09-23 15:23 Sam James
2024-09-02 2:28 Sam James
2024-08-26 13:44 Sam James
2024-08-26 6:24 Sam James
2024-08-23 13:51 Sam James
2024-08-20 20:31 Sam James
2024-08-19 18:43 Sam James
2024-08-14 9:48 Sam James
2024-08-14 2:57 Sam James
2024-08-11 22:40 Sam James
2024-08-09 19:54 Sam James
2024-08-09 19:54 Sam James
2024-08-09 19:47 Sam James
2024-08-09 19:25 Sam James
2024-08-08 11:10 Sam James
2024-08-08 11:06 Sam James
2024-08-08 11:03 Sam James
2024-08-05 9:09 Sam James
2024-08-05 1:54 Sam James
2024-08-05 1:51 Sam James
2024-08-02 20:39 Sam James
2024-08-01 14:40 Sam James
2024-07-28 23:34 Sam James
2024-07-22 1:11 Sam James
2024-07-19 11:14 Sam James
2024-07-18 0:45 Sam James
2024-07-14 23:36 Sam James
2024-06-28 12:49 Sam James
2024-06-27 0:02 Sam James
2024-06-26 23:57 Sam James
2024-06-16 22:45 Sam James
2024-06-10 20:18 Sam James
2024-06-10 17:28 Sam James
2024-06-10 17:28 Sam James
2024-06-10 2:08 Sam James
2024-06-08 17:03 Sam James
2024-06-08 17:03 Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1744663902.146716b7b6b50240e891d78bab4eac96e0eb21a2.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox