From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D76C215802C for ; Fri, 20 Dec 2024 05:57:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E845DE07E6; Fri, 20 Dec 2024 05:57:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F1060E07E6 for ; Fri, 20 Dec 2024 05:57:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2915633BE18 for ; Fri, 20 Dec 2024 05:57:29 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 86E65AF5 for ; Fri, 20 Dec 2024 05:57:27 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1734674220.8c4b3ec7d2a3a535646648d05bcaa6706cc0f695.sam@gentoo> Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ X-VCS-Repository: proj/gcc-patches X-VCS-Files: 15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch 15.0.0/gentoo/README.history X-VCS-Directories: 15.0.0/gentoo/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 8c4b3ec7d2a3a535646648d05bcaa6706cc0f695 X-VCS-Branch: master Date: Fri, 20 Dec 2024 05:57:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7c8cc3f7-524e-49e6-b68e-2b18e8602573 X-Archives-Hash: e1be939dc599917938f31d125f0b73b8 commit: 8c4b3ec7d2a3a535646648d05bcaa6706cc0f695 Author: Sam James gentoo org> AuthorDate: Fri Dec 20 05:57:00 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri Dec 20 05:57:00 2024 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8c4b3ec7 15.0.0: revert patch causing (riscv) bootstrap slowdown Bug: https://gcc.gnu.org/PR118032 Signed-off-by: Sam James gentoo.org> ...le-Add-limit-after-which-slower-switchlow.patch | 238 +++++++++++++++++++++ 15.0.0/gentoo/README.history | 1 + 2 files changed, 239 insertions(+) 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 new file mode 100644 index 0000000..d7f2c46 --- /dev/null +++ b/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch @@ -0,0 +1,238 @@ +From 7305d9452ae9bfc3ee299a194b103e4a4786b0ee Mon Sep 17 00:00:00 2001 +Message-ID: <7305d9452ae9bfc3ee299a194b103e4a4786b0ee.1734674183.git.sam@gentoo.org> +From: Sam James +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 &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; + min.reserve (l + 1); + +@@ -1777,80 +1771,16 @@ jump_table_cluster::is_beneficial (const vec &, + 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 +-bit_test_cluster::find_bit_tests_fast (vec &clusters) +-{ +- unsigned l = clusters.length (); +- vec 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 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 +-bit_test_cluster::find_bit_tests_slow (vec &clusters) ++bit_test_cluster::find_bit_tests (vec &clusters, int max_c) + { ++ if (!is_enabled () || max_c == 1) ++ return clusters.copy (); ++ + unsigned l = clusters.length (); + auto_vec min; + min.reserve (l + 1); +@@ -1904,25 +1834,6 @@ bit_test_cluster::find_bit_tests_slow (vec &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 +-bit_test_cluster::find_bit_tests (vec &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 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 output2; + auto_vec 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 find_bit_tests_fast (vec &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 find_bit_tests_slow (vec &clusters); +- + /* Find bit tests of given CLUSTERS, where all members of the vector + are of type simple_cluster. New clusters are returned. */ + static vec find_bit_tests (vec &clusters, int max_c); + +base-commit: b11e85adbfdb02bc7743098d358a5ea362648ca1 +-- +2.47.1 + diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history index 515a20d..dcaecc1 100644 --- a/15.0.0/gentoo/README.history +++ b/15.0.0/gentoo/README.history @@ -2,6 +2,7 @@ - 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch + 77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch + + 78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch 32 16 December 2024