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: Thu, 12 Jun 2025 05:46:51 +0000 (UTC) [thread overview]
Message-ID: <1749707195.60c5a7be8bfe811a312076812624f30b8ff10cce.sam@gentoo> (raw)
commit: 60c5a7be8bfe811a312076812624f30b8ff10cce
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 12 05:46:35 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 12 05:46:35 2025 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=60c5a7be
16.0.0: add fix for profiledbootstrap
Bug: https://gcc.gnu.org/PR120629
Signed-off-by: Sam James <sam <AT> gentoo.org>
16.0.0/gentoo/75_all_PR120629.patch | 101 ++++++++++++++++++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/16.0.0/gentoo/75_all_PR120629.patch b/16.0.0/gentoo/75_all_PR120629.patch
new file mode 100644
index 0000000..77b562a
--- /dev/null
+++ b/16.0.0/gentoo/75_all_PR120629.patch
@@ -0,0 +1,101 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120629#c22
+
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120629
+ * cfgexpand.cc (expand_gimple_cond): If dest bb isn't BB_RTL,
+ has any PHI nodes and false_edge->dest_idx before redirection is
+ different from make_single_succ_edge result's dest_idx, swap the
+ latter with the former last pred edge and their dest_idx members.
+
+ * g++.dg/opt/pr120629.C: New test.
+
+--- a/gcc/cfgexpand.cc 2025-06-11 19:28:52.462056696 +0200
++++ g/gcc/cfgexpand.cc 2025-06-12 00:05:27.524152553 +0200
+@@ -3013,6 +3013,9 @@ expand_gimple_cond (basic_block bb, gcon
+
+ new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb);
+ dest = false_edge->dest;
++ unsigned int dest_idx = 0;
++ if ((dest->flags & BB_RTL) == 0 && phi_nodes (dest))
++ dest_idx = false_edge->dest_idx;
+ redirect_edge_succ (false_edge, new_bb);
+ false_edge->flags |= EDGE_FALLTHRU;
+ new_bb->count = false_edge->count ();
+@@ -3021,7 +3024,19 @@ expand_gimple_cond (basic_block bb, gcon
+ if (loop->latch == bb
+ && loop->header == dest)
+ loop->latch = new_bb;
+- make_single_succ_edge (new_bb, dest, 0);
++ edge e = make_single_succ_edge (new_bb, dest, 0);
++ if ((dest->flags & BB_RTL) == 0
++ && phi_nodes (dest)
++ && e->dest_idx != dest_idx)
++ {
++ /* If there are any PHI nodes on dest, swap the new succ edge
++ with the one moved into false_edge's former position, so that
++ PHI arguments don't need adjustment. */
++ edge e2 = EDGE_PRED (dest, dest_idx);
++ std::swap (e->dest_idx, e2->dest_idx);
++ std::swap (EDGE_PRED (dest, e->dest_idx),
++ EDGE_PRED (dest, e2->dest_idx));
++ }
+ if (BARRIER_P (BB_END (new_bb)))
+ BB_END (new_bb) = PREV_INSN (BB_END (new_bb));
+ update_bb_for_insn (new_bb);
+--- a/gcc/testsuite/g++.dg/opt/pr120629.C 2025-06-12 00:13:02.928211946 +0200
++++ g/gcc/testsuite/g++.dg/opt/pr120629.C 2025-06-12 00:14:26.008117524 +0200
+@@ -0,0 +1,53 @@
++// PR middle-end/120629
++// { dg-do run }
++// { dg-options "-O2 -fprofile-generate -fno-exceptions -fno-rtti" }
++// { dg-require-profiling "-fprofile-generate" }
++
++__attribute__((noipa, noreturn, cold)) void
++foo (const char *, int, const char *)
++{
++ __builtin_abort ();
++}
++
++struct S
++{
++ __attribute__((noipa)) void bar (void *);
++ static const int a = 8;
++ unsigned int b[a + 1];
++};
++
++__attribute__((noipa)) unsigned long
++baz (void *)
++{
++ static int x = 8;
++ return --x;
++}
++
++__attribute__((noipa)) void
++S::bar (void *x)
++{
++ unsigned int c;
++ int k = 0;
++
++ do
++ {
++ ((void) (!(k <= a) ? foo ("foo", 42, __FUNCTION__), 0 : 0));
++ c = b[k++] = baz (x);
++ }
++ while (c);
++ while (k <= a)
++ b[k++] = 0;
++}
++
++int
++main ()
++{
++ struct T { S a; unsigned int b; } s = {};
++ s.b = 0x1234;
++ s.a.bar (0);
++ for (int i = 0; i < 9; ++i)
++ if (s.a.b[i] != (i == 8 ? 0 : 7 - i))
++ __builtin_abort ();
++ if (s.b != 0x1234)
++ __builtin_abort ();
++}
next reply other threads:[~2025-06-12 5:46 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 5:46 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-07-25 18:49 [gentoo-commits] proj/gcc-patches:master commit in: 16.0.0/gentoo/ 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 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-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=1749707195.60c5a7be8bfe811a312076812624f30b8ff10cce.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