From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 16.0.0/gentoo/
Date: Wed, 17 Sep 2025 18:41:01 +0000 (UTC) [thread overview]
Message-ID: <1758134458.9ce7a56d3f95fb805601d2f9630f2ae311f323fa.sam@gentoo> (raw)
commit: 9ce7a56d3f95fb805601d2f9630f2ae311f323fa
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 17 18:40:51 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 17 18:40:58 2025 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9ce7a56d
16.0.0: drop upstream patches
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../87_all_PR121962-forwprop-hang-prereq.patch | 244 ---------------------
16.0.0/gentoo/88_all_PR121962-forwprop-hang.patch | 161 --------------
16.0.0/gentoo/README.history | 5 -
3 files changed, 410 deletions(-)
diff --git a/16.0.0/gentoo/87_all_PR121962-forwprop-hang-prereq.patch b/16.0.0/gentoo/87_all_PR121962-forwprop-hang-prereq.patch
deleted file mode 100644
index 245a78b..0000000
--- a/16.0.0/gentoo/87_all_PR121962-forwprop-hang-prereq.patch
+++ /dev/null
@@ -1,244 +0,0 @@
-From 41dc015782a42cb64680a55f6766ed5504c4ca53 Mon Sep 17 00:00:00 2001
-Message-ID: <41dc015782a42cb64680a55f6766ed5504c4ca53.1758078219.git.sam@gentoo.org>
-From: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
-Date: Mon, 15 Sep 2025 10:19:13 -0700
-Subject: [PATCH] forwprop: Handle memcpy for arguments with respect to copies
-
-This moves the code used in optimize_agr_copyprop_1 (r16-3887-g597b50abb0d)
-to handle this same case into its new function and use it inside
-optimize_agr_copyprop_arg. This allows to remove more copies that show up only
-in arguments.
-
-Bootstrapped and tested on x86_64-linux-gnu.
-
-gcc/ChangeLog:
-
- * tree-ssa-forwprop.cc (optimize_agr_copyprop_1): Split out
- the case where `operand_equal_p (dest, src2)` is false into ...
- (new_src_based_on_copy): This. New function.
- (optimize_agr_copyprop_arg): Use new_src_based_on_copy
- instead of operand_equal_p to find the new src.
-
-gcc/testsuite/ChangeLog:
-
- * gcc.dg/tree-ssa/copy-prop-aggregate-arg-2.c: New test.
-
-Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
----
- .../tree-ssa/copy-prop-aggregate-arg-2.c | 33 +++++
- gcc/tree-ssa-forwprop.cc | 135 ++++++++++--------
- 2 files changed, 106 insertions(+), 62 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-2.c
-
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-2.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-2.c
-new file mode 100644
-index 000000000000..11f0768c1112
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-2.c
-@@ -0,0 +1,33 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O1 -fdump-tree-forwprop1-details -fdump-tree-optimized" } */
-+
-+
-+struct s1
-+{
-+ int t[1024];
-+};
-+
-+struct s2 {
-+ struct s1 t;
-+};
-+
-+struct s3
-+{
-+ struct s2 t;
-+};
-+
-+void g(struct s3);
-+
-+void f(struct s1 s)
-+{
-+ struct s2 removeme;
-+ removeme.t = s;
-+ struct s3 removeme2;
-+ removeme2.t = removeme;
-+ g(removeme2);
-+}
-+
-+
-+/* { dg-final { scan-tree-dump-times "after previous" 2 "forwprop1" } } */
-+/* { dg-final { scan-tree-dump-not "removeme " "optimized" } } */
-+/* { dg-final { scan-tree-dump-not "removeme2 " "optimized" } } */
-diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
-index 1eacff01587c..f58a7b8c591d 100644
---- a/gcc/tree-ssa-forwprop.cc
-+++ b/gcc/tree-ssa-forwprop.cc
-@@ -1458,6 +1458,72 @@ split_core_and_offset_size (tree expr,
- return core;
- }
-
-+/* Returns a new src based on the
-+ copy `DEST = SRC` and for the old SRC2.
-+ Returns null if SRC2 is not related to DEST. */
-+
-+static tree
-+new_src_based_on_copy (tree src2, tree dest, tree src)
-+{
-+ /* If the second src is not exactly the same as dest,
-+ try to handle it seperately; see it is address/size equivalent.
-+ Handles `a` and `a.b` and `MEM<char[N]>(&a)` which all have
-+ the same size and offsets as address/size equivalent.
-+ This allows copying over a memcpy and also one for copying
-+ where one field is the same size as the whole struct. */
-+ if (operand_equal_p (dest, src2))
-+ return src;
-+ /* A VCE can't be used with imag/real or BFR so reject them early. */
-+ if (TREE_CODE (src) == IMAGPART_EXPR
-+ || TREE_CODE (src) == REALPART_EXPR
-+ || TREE_CODE (src) == BIT_FIELD_REF)
-+ return NULL_TREE;
-+ tree core1, core2;
-+ poly_int64 bytepos1, bytepos2;
-+ poly_int64 bytesize1, bytesize2;
-+ tree toffset1, toffset2;
-+ int reversep1 = 0;
-+ int reversep2 = 0;
-+ poly_int64 diff = 0;
-+ core1 = split_core_and_offset_size (dest, &bytesize1, &bytepos1,
-+ &toffset1, &reversep1);
-+ core2 = split_core_and_offset_size (src2, &bytesize2, &bytepos2,
-+ &toffset2, &reversep2);
-+ if (!core1 || !core2)
-+ return NULL_TREE;
-+ if (reversep1 != reversep2)
-+ return NULL_TREE;
-+ /* The sizes of the 2 accesses need to be the same. */
-+ if (!known_eq (bytesize1, bytesize2))
-+ return NULL_TREE;
-+ if (!operand_equal_p (core1, core2, 0))
-+ return NULL_TREE;
-+
-+ if (toffset1 && toffset2)
-+ {
-+ tree type = TREE_TYPE (toffset1);
-+ if (type != TREE_TYPE (toffset2))
-+ toffset2 = fold_convert (type, toffset2);
-+
-+ tree tdiff = fold_build2 (MINUS_EXPR, type, toffset1, toffset2);
-+ if (!cst_and_fits_in_hwi (tdiff))
-+ return NULL_TREE;
-+
-+ diff = int_cst_value (tdiff);
-+ }
-+ else if (toffset1 || toffset2)
-+ {
-+ /* If only one of the offsets is non-constant, the difference cannot
-+ be a constant. */
-+ return NULL_TREE;
-+ }
-+ diff += bytepos1 - bytepos2;
-+ /* The offset between the 2 need to be 0. */
-+ if (!known_eq (diff, 0))
-+ return NULL_TREE;
-+ return fold_build1 (VIEW_CONVERT_EXPR,TREE_TYPE (src2), src);
-+}
-+
- /* Helper function for optimize_agr_copyprop.
- For aggregate copies in USE_STMT, see if DEST
- is on the lhs of USE_STMT and replace it with SRC. */
-@@ -1474,66 +1540,9 @@ optimize_agr_copyprop_1 (gimple *stmt, gimple *use_stmt,
- /* If the new store is `src2 = src2;` skip over it. */
- if (operand_equal_p (src2, dest2, 0))
- return false;
-- /* If the second src is not exactly the same as dest,
-- try to handle it seperately; see it is address/size equivalent.
-- Handles `a` and `a.b` and `MEM<char[N]>(&a)` which all have
-- the same size and offsets as address/size equivalent.
-- This allows copying over a memcpy and also one for copying
-- where one field is the same size as the whole struct. */
-- if (!operand_equal_p (dest, src2, 0))
-- {
-- /* A VCE can't be used with imag/real or BFR so reject them early. */
-- if (TREE_CODE (src) == IMAGPART_EXPR
-- || TREE_CODE (src) == REALPART_EXPR
-- || TREE_CODE (src) == BIT_FIELD_REF)
-- return false;
-- tree core1, core2;
-- poly_int64 bytepos1, bytepos2;
-- poly_int64 bytesize1, bytesize2;
-- tree toffset1, toffset2;
-- int reversep1 = 0;
-- int reversep2 = 0;
-- poly_int64 diff = 0;
-- core1 = split_core_and_offset_size (dest, &bytesize1, &bytepos1,
-- &toffset1, &reversep1);
-- core2 = split_core_and_offset_size (src2, &bytesize2, &bytepos2,
-- &toffset2, &reversep2);
-- if (!core1 || !core2)
-- return false;
-- if (reversep1 != reversep2)
-- return false;
-- /* The sizes of the 2 accesses need to be the same. */
-- if (!known_eq (bytesize1, bytesize2))
-- return false;
-- if (!operand_equal_p (core1, core2, 0))
-- return false;
--
-- if (toffset1 && toffset2)
-- {
-- tree type = TREE_TYPE (toffset1);
-- if (type != TREE_TYPE (toffset2))
-- toffset2 = fold_convert (type, toffset2);
--
-- tree tdiff = fold_build2 (MINUS_EXPR, type, toffset1, toffset2);
-- if (!cst_and_fits_in_hwi (tdiff))
-- return false;
--
-- diff = int_cst_value (tdiff);
-- }
-- else if (toffset1 || toffset2)
-- {
-- /* If only one of the offsets is non-constant, the difference cannot
-- be a constant. */
-- return false;
-- }
-- diff += bytepos1 - bytepos2;
-- /* The offset between the 2 need to be 0. */
-- if (!known_eq (diff, 0))
-- return false;
-- src = fold_build1_loc (gimple_location (use_stmt),
-- VIEW_CONVERT_EXPR,
-- TREE_TYPE (src2), src);
-- }
-+ src = new_src_based_on_copy (src2, dest, src);
-+ if (!src)
-+ return false;
- /* For 2 memory refences and using a temporary to do the copy,
- don't remove the temporary as the 2 memory references might overlap.
- Note t does not need to be decl as it could be field.
-@@ -1634,8 +1643,10 @@ optimize_agr_copyprop_arg (gimple *defstmt, gcall *call,
- || is_gimple_min_invariant (*argptr)
- || TYPE_VOLATILE (TREE_TYPE (*argptr)))
- continue;
-- if (!operand_equal_p (*argptr, dest, 0))
-+ tree newsrc = new_src_based_on_copy (*argptr, dest, src);
-+ if (!newsrc)
- continue;
-+
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Simplified\n ");
-@@ -1643,7 +1654,7 @@ optimize_agr_copyprop_arg (gimple *defstmt, gcall *call,
- fprintf (dump_file, "after previous\n ");
- print_gimple_stmt (dump_file, defstmt, 0, dump_flags);
- }
-- *argptr = unshare_expr (src);
-+ *argptr = unshare_expr (newsrc);
- changed = true;
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
-
-base-commit: e690b97761e18daccb4fff0151c97c1d0115b55f
---
-2.51.0
-
diff --git a/16.0.0/gentoo/88_all_PR121962-forwprop-hang.patch b/16.0.0/gentoo/88_all_PR121962-forwprop-hang.patch
deleted file mode 100644
index 52d25d6..0000000
--- a/16.0.0/gentoo/88_all_PR121962-forwprop-hang.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121962#c11
-
-From 9463f1db7bc409b9a59dab1d11b6e82e423c4466 Mon Sep 17 00:00:00 2001
-From: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
-Date: Tue, 16 Sep 2025 10:55:03 -0700
-Subject: [PATCH] forwprop: Fix up "nop" copies after recent changes [PR121962]
-
-After r16-3887-g597b50abb0d2fc, the check to see if the copy is
-a nop copy becomes inefficient. The code going into an infinite
-loop as the copy keeps on being propagated over and over again.
-
-That is if we have:
-```
- struct s1 *b = &a.t;
- a.t = *b;
- p = *b;
-```
-
-This goes into an infinite loop propagating over and over again the
-`MEM[&a]`.
-To solve this a new function is needed for the comparison that is
-similar to new_src_based_on_copy.
-
- PR tree-optimization/121962
-
-gcc/ChangeLog:
-
- * tree-ssa-forwprop.cc (same_for_assignment): New function.
- (optimize_agr_copyprop_1): Use same_for_assignment to check for
- nop copies.
- (optimize_agr_copyprop): Likewise.
-
-gcc/testsuite/ChangeLog:
-
- * gcc.dg/torture/pr121962-1.c: New test.
-
-Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
----
- gcc/testsuite/gcc.dg/torture/pr121962-1.c | 21 ++++++++
- gcc/tree-ssa-forwprop.cc | 64 ++++++++++++++++++++++-
- 2 files changed, 83 insertions(+), 2 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/torture/pr121962-1.c
-
-diff --git a/gcc/testsuite/gcc.dg/torture/pr121962-1.c b/gcc/testsuite/gcc.dg/torture/pr121962-1.c
-new file mode 100644
-index 00000000000..97f88ad5734
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr121962-1.c
-@@ -0,0 +1,21 @@
-+/* PR tree-optimization/121962 */
-+struct s1
-+{
-+ int t;
-+};
-+
-+struct s2
-+{
-+ struct s1 t;
-+};
-+
-+struct s1 p;
-+
-+void f(struct s2 a)
-+{
-+ struct s1 *b = &a.t;
-+ /* this is a nop load/store and should be ignored
-+ by copy propagation for aggregates. */
-+ a.t = *b;
-+ p = *b;
-+}
-diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
-index 9d389e1b9bf..833a354ce2c 100644
---- a/gcc/tree-ssa-forwprop.cc
-+++ b/gcc/tree-ssa-forwprop.cc
-@@ -1528,6 +1528,66 @@ new_src_based_on_copy (tree src2, tree dest, tree src)
- return fold_build1 (VIEW_CONVERT_EXPR,TREE_TYPE (src2), src);
- }
-
-+/* Returns true if SRC and DEST are the same address such that
-+ `SRC == DEST;` is conisdered a nop. This is more than an
-+ operand_equal_p check as it needs to be similar to
-+ new_src_based_on_copy. */
-+
-+static bool
-+same_for_assignment (tree src, tree dest)
-+{
-+ if (operand_equal_p (dest, src, 0))
-+ return true;
-+ /* if both dest and src2 are decls, then we know these 2
-+ accesses can't be the same. */
-+ if (DECL_P (dest) && DECL_P (src))
-+ return false;
-+
-+ tree core1, core2;
-+ poly_int64 bytepos1, bytepos2;
-+ poly_int64 bytesize1, bytesize2;
-+ tree toffset1, toffset2;
-+ int reversep1 = 0;
-+ int reversep2 = 0;
-+ poly_int64 diff = 0;
-+ core1 = split_core_and_offset_size (dest, &bytesize1, &bytepos1,
-+ &toffset1, &reversep1);
-+ core2 = split_core_and_offset_size (src, &bytesize2, &bytepos2,
-+ &toffset2, &reversep2);
-+ if (!core1 || !core2)
-+ return false;
-+ if (reversep1 != reversep2)
-+ return false;
-+ /* The sizes of the 2 accesses need to be the same. */
-+ if (!known_eq (bytesize1, bytesize2))
-+ return false;
-+ if (!operand_equal_p (core1, core2, 0))
-+ return false;
-+ if (toffset1 && toffset2)
-+ {
-+ tree type = TREE_TYPE (toffset1);
-+ if (type != TREE_TYPE (toffset2))
-+ toffset2 = fold_convert (type, toffset2);
-+
-+ tree tdiff = fold_build2 (MINUS_EXPR, type, toffset1, toffset2);
-+ if (!cst_and_fits_in_hwi (tdiff))
-+ return false;
-+
-+ diff = int_cst_value (tdiff);
-+ }
-+ else if (toffset1 || toffset2)
-+ {
-+ /* If only one of the offsets is non-constant, the difference cannot
-+ be a constant. */
-+ return false;
-+ }
-+ diff += bytepos1 - bytepos2;
-+ /* The offset between the 2 need to be 0. */
-+ if (!known_eq (diff, 0))
-+ return false;
-+ return true;
-+}
-+
- /* Helper function for optimize_agr_copyprop.
- For aggregate copies in USE_STMT, see if DEST
- is on the lhs of USE_STMT and replace it with SRC. */
-@@ -1542,7 +1602,7 @@ optimize_agr_copyprop_1 (gimple *stmt, gimple *use_stmt,
- tree dest2 = gimple_assign_lhs (use_stmt);
- tree src2 = gimple_assign_rhs1 (use_stmt);
- /* If the new store is `src2 = src2;` skip over it. */
-- if (operand_equal_p (src2, dest2, 0))
-+ if (same_for_assignment (src2, dest2))
- return false;
- src = new_src_based_on_copy (src2, dest, src);
- if (!src)
-@@ -1702,7 +1762,7 @@ optimize_agr_copyprop (gimple_stmt_iterator *gsip)
- tree dest = gimple_assign_lhs (stmt);
- tree src = gimple_assign_rhs1 (stmt);
- /* If the statement is `src = src;` then ignore it. */
-- if (operand_equal_p (dest, src, 0))
-+ if (same_for_assignment (dest, src))
- return false;
-
- tree vdef = gimple_vdef (stmt);
---
-2.43.0
diff --git a/16.0.0/gentoo/README.history b/16.0.0/gentoo/README.history
index 023c43f..3a58f30 100644
--- a/16.0.0/gentoo/README.history
+++ b/16.0.0/gentoo/README.history
@@ -1,8 +1,3 @@
-15 ????
-
- + 87_all_PR121962-forwprop-hang-prereq.patch
- + 88_all_PR121962-forwprop-hang.patch
-
14 7 September 2025
- 91_all_PR121699-mesa.patch
next reply other threads:[~2025-09-17 18:41 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 18:41 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-10-21 0:33 [gentoo-commits] proj/gcc-patches:master commit in: 16.0.0/gentoo/ Sam James
2025-10-19 22:41 Sam James
2025-10-18 18:22 Sam James
2025-10-13 2:49 Sam James
2025-10-09 7:31 Sam James
2025-10-09 2:26 Sam James
2025-10-09 2:26 Sam James
2025-10-05 23:05 Sam James
2025-10-05 22:50 Sam James
2025-10-02 11:05 Sam James
2025-10-02 11:04 Sam James
2025-10-02 4:55 Sam James
2025-10-02 1:18 Sam James
2025-10-02 0:40 Sam James
2025-10-02 0:36 Sam James
2025-10-02 0:30 Sam James
2025-09-17 3:04 Sam James
2025-09-16 19:23 Sam James
2025-09-14 11:26 Sam James
2025-09-13 13:16 Sam James
2025-09-07 22:42 Sam James
2025-09-06 2:42 Sam James
2025-09-05 12:44 Sam James
2025-09-01 8:04 Sam James
2025-08-31 22:43 Sam James
2025-08-30 14:06 Sam James
2025-08-30 8:05 Sam James
2025-08-30 6:57 Sam James
2025-08-30 0:12 Sam James
2025-08-29 21:26 Sam James
2025-08-29 21:02 Sam James
2025-08-29 20:24 Sam James
2025-08-29 20:18 Sam James
2025-08-29 18:38 Sam James
2025-08-29 12:15 Sam James
2025-08-28 17:57 Sam James
2025-08-28 5:27 Sam James
2025-08-27 4:19 Sam James
2025-08-26 23:42 Sam James
2025-08-26 4:48 Sam James
2025-08-26 0:56 Sam James
2025-08-25 3:55 Sam James
2025-08-24 23:42 Sam James
2025-08-21 16:11 Sam James
2025-08-20 20:45 Sam James
2025-08-20 14:10 Sam James
2025-08-20 1:16 Sam James
2025-08-20 1:10 Sam James
2025-08-19 16:30 Sam James
2025-08-18 23:52 Sam James
2025-08-18 23:08 Sam James
2025-08-17 22:45 Sam James
2025-08-17 21:01 Sam James
2025-08-17 16:30 Sam James
2025-08-17 15:44 Sam James
2025-08-17 15:10 Sam James
2025-08-16 23:06 Sam James
2025-08-05 0:23 Sam James
2025-07-30 22:35 Sam James
2025-07-30 0:44 Sam James
2025-07-30 0:44 Sam James
2025-07-25 18:49 Sam James
2025-07-23 11:22 Sam James
2025-07-22 23:56 Sam James
2025-07-21 14:02 Sam James
2025-07-21 1:12 Sam James
2025-07-14 16:03 Sam James
2025-07-14 4:09 Sam James
2025-07-14 2:55 Sam James
2025-07-14 2:55 Sam James
2025-07-14 2:40 Sam James
2025-07-13 23:11 Sam James
2025-07-13 1:09 Sam James
2025-07-12 15:24 Sam James
2025-07-12 15:23 Sam James
2025-07-10 12:34 Sam James
2025-07-10 1:22 Sam James
2025-07-10 0:50 Sam James
2025-07-07 20:49 Sam James
2025-07-06 22:41 Sam James
2025-07-03 1:29 Sam James
2025-06-30 6:26 Sam James
2025-06-29 23:49 Sam James
2025-06-29 0:29 Sam James
2025-06-19 16:59 Sam James
2025-06-19 0:58 Sam James
2025-06-19 0:58 Sam James
2025-06-18 21:17 Sam James
2025-06-18 9:53 Sam James
2025-06-18 9:06 Sam James
2025-06-13 12:03 Sam James
2025-06-12 20:34 Sam James
2025-06-12 14:05 Sam James
2025-06-12 7:27 Sam James
2025-06-12 5:46 Sam James
2025-06-11 5:05 Sam James
2025-06-11 3:19 Sam James
2025-06-01 22:39 Sam James
2025-05-31 18:48 Sam James
2025-05-11 22:52 Sam James
2025-05-10 15:28 Sam James
2025-05-09 23:29 Sam James
2025-05-05 14:39 Sam James
2025-05-05 13:05 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=1758134458.9ce7a56d3f95fb805601d2f9630f2ae311f323fa.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