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, 06 Jan 2025 04:13:56 +0000 (UTC) [thread overview]
Message-ID: <1736136827.69d385f037f98eb238a58176d58aa628a1b2a2f8.sam@gentoo> (raw)
commit: 69d385f037f98eb238a58176d58aa628a1b2a2f8
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 6 04:12:18 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 6 04:13:47 2025 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=69d385f0
15.0.0: update switch-conversion patch
mjw's change is far smaller and targeted, so switch to that.
Bug: https://gcc.gnu.org/PR118032
Signed-off-by: Sam James <sam <AT> gentoo.org>
...le-Add-limit-after-which-slower-switchlow.patch | 238 ---------------------
...-conversion-don-t-apply-switch-size-limit.patch | 51 +++++
15.0.0/gentoo/README.history | 2 +
3 files changed, 53 insertions(+), 238 deletions(-)
diff --git a/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch b/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
deleted file mode 100644
index d7f2c46..0000000
--- a/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
+++ /dev/null
@@ -1,238 +0,0 @@
-From 7305d9452ae9bfc3ee299a194b103e4a4786b0ee Mon Sep 17 00:00:00 2001
-Message-ID: <7305d9452ae9bfc3ee299a194b103e4a4786b0ee.1734674183.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Fri, 20 Dec 2024 05:56:03 +0000
-Subject: [PATCH] Revert "gimple: Add limit after which slower switchlower algs
- are used [PR117091] [PR117352]"
-
-This reverts commit 56946c801a7cf3a831a11870b7e11ba08bf9bd87.
-
-Bug: https://gcc.gnu.org/PR118032
----
- gcc/doc/invoke.texi | 3 -
- gcc/params.opt | 4 --
- gcc/tree-switch-conversion.cc | 112 +++-------------------------------
- gcc/tree-switch-conversion.h | 18 ------
- 4 files changed, 7 insertions(+), 130 deletions(-)
-
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 8ed5536365f7..08ad6b998b79 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -16522,9 +16522,6 @@ Switch initialization conversion refuses to create arrays that are
- bigger than @option{switch-conversion-max-branch-ratio} times the number of
- branches in the switch.
-
--@item switch-lower-slow-alg-max-cases
--Maximum number of cases for slow switch lowering algorithms to be used.
--
- @item max-partial-antic-length
- Maximum length of the partial antic set computed during the tree
- partial redundancy elimination optimization (@option{-ftree-pre}) when
-diff --git a/gcc/params.opt b/gcc/params.opt
-index 1c88d5212c40..5853bf02f9ee 100644
---- a/gcc/params.opt
-+++ b/gcc/params.opt
-@@ -1052,10 +1052,6 @@ Maximum number of instruction distance that a small store forwarded to a larger
- Common Joined UInteger Var(param_switch_conversion_branch_ratio) Init(8) IntegerRange(1, 65536) Param Optimization
- The maximum ratio between array size and switch branches for a switch conversion to take place.
-
---param=switch-lower-slow-alg-max-cases=
--Common Joined UInteger Var(param_switch_lower_slow_alg_max_cases) Init(1000) IntegerRange(1, 1000000000) Param Optimization
--Maximum number of cases for slow switch lowering algorithms to be used.
--
- -param=modref-max-bases=
- Common Joined UInteger Var(param_modref_max_bases) Init(32) Param Optimization
- Maximum number of bases stored in each modref tree.
-diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
-index b98e70cf7d16..3436c2a8b98c 100644
---- a/gcc/tree-switch-conversion.cc
-+++ b/gcc/tree-switch-conversion.cc
-@@ -54,7 +54,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
- #include "tree-cfgcleanup.h"
- #include "hwint.h"
- #include "internal-fn.h"
--#include "diagnostic-core.h"
-
- /* ??? For lang_hooks.types.type_for_mode, but is there a word_mode
- type in the GIMPLE type system that is language-independent? */
-@@ -1642,11 +1641,6 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
- return clusters.copy ();
-
- unsigned l = clusters.length ();
--
-- /* Note: l + 1 is the number of cases of the switch. */
-- if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
-- return clusters.copy ();
--
- auto_vec<min_cluster_item> min;
- min.reserve (l + 1);
-
-@@ -1777,80 +1771,16 @@ jump_table_cluster::is_beneficial (const vec<cluster *> &,
- return end - start + 1 >= case_values_threshold ();
- }
-
--/* Find bit tests of given CLUSTERS, where all members of the vector are of
-- type simple_cluster. Use a fast algorithm that might not find the optimal
-- solution (minimal number of clusters on the output). New clusters are
-- returned.
--
-- You should call find_bit_tests () instead of calling this function
-- directly. */
--
--vec<cluster *>
--bit_test_cluster::find_bit_tests_fast (vec<cluster *> &clusters)
--{
-- unsigned l = clusters.length ();
-- vec<cluster *> output;
--
-- output.create (l);
--
-- /* Look at sliding BITS_PER_WORD sized windows in the switch value space
-- and determine if they are suitable for a bit test cluster. Worst case
-- this can examine every value BITS_PER_WORD-1 times. */
-- unsigned k;
-- for (unsigned i = 0; i < l; i += k)
-- {
-- hash_set<basic_block> targets;
-- cluster *start_cluster = clusters[i];
--
-- /* Find the biggest k such that clusters i to i+k-1 can be turned into a
-- one big bit test cluster. */
-- k = 0;
-- while (i + k < l)
-- {
-- cluster *end_cluster = clusters[i + k];
--
-- /* Does value range fit into the BITS_PER_WORD window? */
-- HOST_WIDE_INT w = cluster::get_range (start_cluster->get_low (),
-- end_cluster->get_high ());
-- if (w == 0 || w > BITS_PER_WORD)
-- break;
--
-- /* Check for max # of targets. */
-- if (targets.elements () == m_max_case_bit_tests
-- && !targets.contains (end_cluster->m_case_bb))
-- break;
--
-- targets.add (end_cluster->m_case_bb);
-- k++;
-- }
--
-- if (is_beneficial (k, targets.elements ()))
-- {
-- output.safe_push (new bit_test_cluster (clusters, i, i + k - 1,
-- i == 0 && k == l));
-- }
-- else
-- {
-- output.safe_push (clusters[i]);
-- /* ??? Might be able to skip more. */
-- k = 1;
-- }
-- }
--
-- return output;
--}
--
- /* Find bit tests of given CLUSTERS, where all members of the vector
-- are of type simple_cluster. Use a slow (quadratic) algorithm that always
-- finds the optimal solution (minimal number of clusters on the output). New
-- clusters are returned.
--
-- You should call find_bit_tests () instead of calling this function
-- directly. */
-+ are of type simple_cluster. MAX_C is the approx max number of cases per
-+ label. New clusters are returned. */
-
- vec<cluster *>
--bit_test_cluster::find_bit_tests_slow (vec<cluster *> &clusters)
-+bit_test_cluster::find_bit_tests (vec<cluster *> &clusters, int max_c)
- {
-+ if (!is_enabled () || max_c == 1)
-+ return clusters.copy ();
-+
- unsigned l = clusters.length ();
- auto_vec<min_cluster_item> min;
- min.reserve (l + 1);
-@@ -1904,25 +1834,6 @@ bit_test_cluster::find_bit_tests_slow (vec<cluster *> &clusters)
- return output;
- }
-
--/* Find bit tests of given CLUSTERS, where all members of the vector
-- are of type simple_cluster. MAX_C is the approx max number of cases per
-- label. New clusters are returned. */
--
--vec<cluster *>
--bit_test_cluster::find_bit_tests (vec<cluster *> &clusters, int max_c)
--{
-- if (!is_enabled () || max_c == 1)
-- return clusters.copy ();
--
-- unsigned l = clusters.length ();
--
-- /* Note: l + 1 is the number of cases of the switch. */
-- if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
-- return find_bit_tests_fast (clusters);
-- else
-- return find_bit_tests_slow (clusters);
--}
--
- /* Return true when RANGE of case values with UNIQ labels
- can build a bit test. */
-
-@@ -2353,19 +2264,10 @@ switch_decision_tree::analyze_switch_statement ()
-
- reset_out_edges_aux (m_switch);
-
-- if (l > (unsigned) param_switch_lower_slow_alg_max_cases)
-- warning_at (gimple_location (m_switch), OPT_Wdisabled_optimization,
-- "Using faster switch lowering algorithms. "
-- "Number of switch cases (%d) exceeds "
-- "%<--param=switch-lower-slow-alg-max-cases=%d%> limit.",
-- l, param_switch_lower_slow_alg_max_cases);
--
- /* Find bit-test clusters. */
- vec<cluster *> output = bit_test_cluster::find_bit_tests (clusters, max_c);
-
-- /* Find jump table clusters. We are looking for these in the sequences of
-- simple clusters which we didn't manage to convert into bit-test
-- clusters. */
-+ /* Find jump table clusters. */
- vec<cluster *> output2;
- auto_vec<cluster *> tmp;
- output2.create (1);
-diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
-index 560620903a86..e6a85fa60258 100644
---- a/gcc/tree-switch-conversion.h
-+++ b/gcc/tree-switch-conversion.h
-@@ -397,24 +397,6 @@ public:
- tree default_label_expr, basic_block default_bb, location_t loc)
- final override;
-
-- /* Find bit tests of given CLUSTERS, where all members of the vector are of
-- type simple_cluster. Use a fast algorithm that might not find the optimal
-- solution (minimal number of clusters on the output). New clusters are
-- returned.
--
-- You should call find_bit_tests () instead of calling this function
-- directly. */
-- static vec<cluster *> find_bit_tests_fast (vec<cluster *> &clusters);
--
-- /* Find bit tests of given CLUSTERS, where all members of the vector
-- are of type simple_cluster. Use a slow (quadratic) algorithm that always
-- finds the optimal solution (minimal number of clusters on the output). New
-- clusters are returned.
--
-- You should call find_bit_tests () instead of calling this function
-- directly. */
-- static vec<cluster *> find_bit_tests_slow (vec<cluster *> &clusters);
--
- /* Find bit tests of given CLUSTERS, where all members of the vector
- are of type simple_cluster. New clusters are returned. */
- static vec<cluster *> find_bit_tests (vec<cluster *> &clusters, int max_c);
-
-base-commit: b11e85adbfdb02bc7743098d358a5ea362648ca1
---
-2.47.1
-
diff --git a/15.0.0/gentoo/78_all_PR118032-tree-switch-conversion-don-t-apply-switch-size-limit.patch b/15.0.0/gentoo/78_all_PR118032-tree-switch-conversion-don-t-apply-switch-size-limit.patch
new file mode 100644
index 0000000..20018ef
--- /dev/null
+++ b/15.0.0/gentoo/78_all_PR118032-tree-switch-conversion-don-t-apply-switch-size-limit.patch
@@ -0,0 +1,51 @@
+https://inbox.sourceware.org/gcc-patches/20250105172539.906393-1-mark@klomp.org/
+
+From 4e8dc9973c98a8b0c5cfe555221dc7dee5d92662 Mon Sep 17 00:00:00 2001
+Message-ID: <4e8dc9973c98a8b0c5cfe555221dc7dee5d92662.1736136715.git.sam@gentoo.org>
+From: Mark Wielaard <mark@klomp.org>
+Date: Sun, 5 Jan 2025 18:25:39 +0100
+Subject: [PATCH] tree-switch-conversion: don't apply switch size limit on jump
+ tables
+
+commit 56946c801a7c ("gimple: Add limit after which slower switchlower
+algs are used [PR117091] [PR117352]") introduced a limit on the number
+of cases of a switch. It also bails out on finding jump tables if the
+switch is too large. This introduces a compile time regression during
+bootstrap. A riscv bootstrap takes hours longer. Particularly
+insn-attrtab.cc will take hours instead of minutes. Fix this by not
+applying the switch size limit on jump tables.
+
+An alternative would be to implement greedy switch clustering for jump
+tables as is done for switch bitmap clustering.
+
+gcc/ChangeLog:
+
+PR tree-optimization/118032
+ * tree-switch-conversion.cc (jump_table_cluster::find_jump_tables):
+ Remove param_switch_lower_slow_alg_max_cases check.
+---
+ gcc/tree-switch-conversion.cc | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
+index 432970597c97..39a8a893edde 100644
+--- a/gcc/tree-switch-conversion.cc
++++ b/gcc/tree-switch-conversion.cc
+@@ -1643,10 +1643,6 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
+
+ unsigned l = clusters.length ();
+
+- /* Note: l + 1 is the number of cases of the switch. */
+- if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
+- return clusters.copy ();
+-
+ auto_vec<min_cluster_item> min;
+ min.reserve (l + 1);
+
+
+base-commit: 451ff5b58f7c5958f8341160343680262944a63f
+prerequisite-patch-id: cca034489e37f362f6ff4ff1aba0258270153a6a
+prerequisite-patch-id: dcb0315887787c40fae21980c53d20d0b6e234b7
+--
+2.47.1
+
diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index b49ecdf..412cb40 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,7 @@
37 ????
+ - 78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
+ + 78_all_PR118032-tree-switch-conversion-don-t-apply-switch-size-limit.patch
+ 80_all_PR81358-Enable-automatic-linking-of-libatomic.patch
+ 81_all_PR118199-c-Clear-TARGET_EXPR_ELIDING_P-when-forced-to-use-a-c.patch
next reply other threads:[~2025-01-06 4:13 UTC|newest]
Thread overview: 165+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 4:13 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-13 10:08 [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ 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: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=1736136827.69d385f037f98eb238a58176d58aa628a1b2a2f8.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