summaryrefslogtreecommitdiff
path: root/system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-05-23 23:40:10 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-06-11 14:03:55 -0500
commitfea61b9e1973a6ca7efe6cdf91e87c7604d54dd6 (patch)
treedfbe2ea0114eaf6c9fa04043def5f921a29efaec /system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch
parentaec78470ff4b2c671c4a522920681947c0209e11 (diff)
downloadpackages-fea61b9e1973a6ca7efe6cdf91e87c7604d54dd6.tar.gz
packages-fea61b9e1973a6ca7efe6cdf91e87c7604d54dd6.tar.bz2
packages-fea61b9e1973a6ca7efe6cdf91e87c7604d54dd6.tar.xz
packages-fea61b9e1973a6ca7efe6cdf91e87c7604d54dd6.zip
system/gcc: Update to 13.3.0
0012-static-pie and 201-ada were forward-ported by my own paws. Three digit 0xx underscore patches are from Gentoo. This is also the source of the insn-split and match-split patches, which significantly increase performance on build. They are also the source of the new configure option --with-matchpd-partitions. On systems with very many cores/threads, a number higher than 32 would probably perform even better, but 32 should give decent perf on 8+ threads, and runs quite nicely on the 64-thread Talos II I ran the testbuild on. 202 is from Void. The 300s are originally written by me. The Ada patch now includes an improvement to use posix_openpt instead of getpt, which fixes link errors later on. We also now use STAGE1_CFLAGS and BOOT_CFLAGS to improve build times. Improvement was clocked from 40m to 32m (-8m, or 20%) on gwyn. The patch for Go name mangling is needed to build packages that use reflect2, which includes user/gitlab-runner.
Diffstat (limited to 'system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch')
-rw-r--r--system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch b/system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch
new file mode 100644
index 000000000..95da940fe
--- /dev/null
+++ b/system/gcc/076_all_match.pd-don-t-emit-label-if-not-needed.patch
@@ -0,0 +1,114 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21
+
+From 6178fddd3e0957fbb8bcfc443fef172691b7640b Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 5 May 2023 13:35:17 +0100
+Subject: [PATCH 01/15] match.pd: don't emit label if not needed
+
+This is a small QoL codegen improvement for match.pd to not emit labels when
+they are not needed. The codegen is nice and there is a small (but consistent)
+improvement in compile time.
+
+gcc/ChangeLog:
+
+ PR bootstrap/84402
+ * genmatch.cc (dt_simplify::gen_1): Only emit labels if used.
+
+(cherry picked from commit 580cda3c2799b1f8323af770e52f1eb0fa204718)
+---
+ gcc/genmatch.cc | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
+index c1023d921fca..9ecd0a462b4f 100644
+--- a/gcc/genmatch.cc
++++ b/gcc/genmatch.cc
+@@ -3354,6 +3354,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ char local_fail_label[256];
+ snprintf (local_fail_label, 256, "next_after_fail%u", ++fail_label_cnt);
+ fail_label = local_fail_label;
++ bool needs_label = false;
+
+ /* Analyze captures and perform early-outs on the incoming arguments
+ that cover cases we cannot handle. */
+@@ -3368,6 +3369,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ fprintf_indent (f, indent,
+ "if (TREE_SIDE_EFFECTS (_p%d)) goto %s;\n",
+ i, fail_label);
++ needs_label = true;
+ if (verbose >= 1)
+ warning_at (as_a <expr *> (s->match)->ops[i]->location,
+ "forcing toplevel operand to have no "
+@@ -3383,6 +3385,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ fprintf_indent (f, indent,
+ "if (TREE_SIDE_EFFECTS (captures[%d])) "
+ "goto %s;\n", i, fail_label);
++ needs_label = true;
+ if (verbose >= 1)
+ warning_at (cinfo.info[i].c->location,
+ "forcing captured operand to have no "
+@@ -3425,7 +3428,10 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ }
+
+ if (s->kind == simplify::SIMPLIFY)
+- fprintf_indent (f, indent, "if (UNLIKELY (!dbg_cnt (match))) goto %s;\n", fail_label);
++ {
++ fprintf_indent (f, indent, "if (UNLIKELY (!dbg_cnt (match))) goto %s;\n", fail_label);
++ needs_label = true;
++ }
+
+ fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) "
+ "fprintf (dump_file, \"%s ",
+@@ -3498,9 +3504,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ "res_op->resimplify (%s, valueize);\n",
+ !e->force_leaf ? "lseq" : "NULL");
+ if (e->force_leaf)
+- fprintf_indent (f, indent,
+- "if (!maybe_push_res_to_seq (res_op, NULL)) "
+- "goto %s;\n", fail_label);
++ {
++ fprintf_indent (f, indent,
++ "if (!maybe_push_res_to_seq (res_op, NULL)) "
++ "goto %s;\n", fail_label);
++ needs_label = true;
++ }
+ }
+ }
+ else if (result->type == operand::OP_CAPTURE
+@@ -3556,9 +3565,12 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ continue;
+ if (cinfo.info[i].result_use_count
+ > cinfo.info[i].match_use_count)
+- fprintf_indent (f, indent,
+- "if (! tree_invariant_p (captures[%d])) "
+- "goto %s;\n", i, fail_label);
++ {
++ fprintf_indent (f, indent,
++ "if (! tree_invariant_p (captures[%d])) "
++ "goto %s;\n", i, fail_label);
++ needs_label = true;
++ }
+ }
+ for (unsigned j = 0; j < e->ops.length (); ++j)
+ {
+@@ -3609,6 +3621,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ {
+ fprintf_indent (f, indent, "if (!_r)\n");
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
++ needs_label = true;
+ }
+ }
+ }
+@@ -3649,7 +3662,8 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
+ }
+ indent -= 2;
+ fprintf_indent (f, indent, "}\n");
+- fprintf (f, "%s:;\n", fail_label);
++ if (needs_label)
++ fprintf (f, "%s:;\n", fail_label);
+ fail_label = NULL;
+ }
+
+--
+2.44.0
+