diff --git a/0053-Loop-distribution-and-SLP-Bugfix.patch b/0053-Loop-distribution-and-SLP-Bugfix.patch new file mode 100644 index 0000000000000000000000000000000000000000..bb2eae612b91719e8ce7bb1d3f69f066923d165f --- /dev/null +++ b/0053-Loop-distribution-and-SLP-Bugfix.patch @@ -0,0 +1,42 @@ +From 4e5600acfa0eb8ec25b3a15a308ebeaeca6675f4 Mon Sep 17 00:00:00 2001 +From: benniaobufeijiushiji +Date: Thu, 7 Jul 2022 10:40:21 +0800 +Subject: [PATCH 1/2] [Loop-distribution and SLP] Bugfix + +Fix bugs for gate flags and cost comparison +--- + gcc/tree-loop-distribution.c | 2 +- + gcc/tree-vect-slp.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c +index 765d9ed3a..11f9f48e8 100644 +--- a/gcc/tree-loop-distribution.c ++++ b/gcc/tree-loop-distribution.c +@@ -3149,7 +3149,7 @@ bool + loop_distribution::may_insert_temp_arrays (loop_p loop, struct graph * &rdg, + control_dependences *cd) + { +- if (!flag_tree_slp_transpose_vectorize) ++ if (!(flag_tree_slp_transpose_vectorize && flag_tree_loop_vectorize)) + { + return false; + } +diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c +index b616af7d2..e85f6c6bc 100644 +--- a/gcc/tree-vect-slp.c ++++ b/gcc/tree-vect-slp.c +@@ -4315,8 +4315,8 @@ may_chose_transpose_bbvinfo (bb_vec_info bb_vinfo_trans, bool res_trans, + 2) The vec cost is similar to scalar cost in the transposed version. */ + if ((res_ori && res_trans && diff_bb_cost >= diff_bb_cost_trans) + || (res_trans && BB_VINFO_SCALAR_COST (bb_vinfo_trans) +- < (BB_VINFO_VEC_INSIDE_COST (bb_vinfo_trans) +- + BB_VINFO_VEC_OUTSIDE_COST (bb_vinfo_trans)))) ++ <= (BB_VINFO_VEC_INSIDE_COST (bb_vinfo_trans) ++ + BB_VINFO_VEC_OUTSIDE_COST (bb_vinfo_trans)))) + { + return false; + } +-- +2.27.0 + diff --git a/0054-Semi-relayout-Bugfix.patch b/0054-Semi-relayout-Bugfix.patch new file mode 100644 index 0000000000000000000000000000000000000000..8acd91ecba77428fd8789794435ba999a4e21d03 --- /dev/null +++ b/0054-Semi-relayout-Bugfix.patch @@ -0,0 +1,100 @@ +From 5ad2d827f7c722b0b0c95827adb91a63b2391a26 Mon Sep 17 00:00:00 2001 +From: benniaobufeijiushiji +Date: Thu, 7 Jul 2022 10:56:56 +0800 +Subject: [PATCH 2/2] [Semi-relayout] Bugfix + +Bugfix for struct semi-relayout on rewrite conditions +--- + gcc/ipa-struct-reorg/ipa-struct-reorg.c | 40 ++++++++++++++----------- + gcc/params.opt | 2 +- + 2 files changed, 23 insertions(+), 19 deletions(-) + +diff --git a/gcc/ipa-struct-reorg/ipa-struct-reorg.c b/gcc/ipa-struct-reorg/ipa-struct-reorg.c +index 9798aec96..ade1ed1a9 100644 +--- a/gcc/ipa-struct-reorg/ipa-struct-reorg.c ++++ b/gcc/ipa-struct-reorg/ipa-struct-reorg.c +@@ -6401,6 +6401,8 @@ ipa_struct_reorg::is_semi_relayout_candidate (tree xhs) + { + tree type = TREE_TYPE (mem); + srtype *old_type = get_relayout_candidate_type (type); ++ if (!old_type) ++ return false; + if (types_compatible_p (type, old_type->type) && old_type->semi_relayout) + return true; + } +@@ -7321,6 +7323,10 @@ ipa_struct_reorg::check_sr_copy (gimple *stmt) + + srtype *t1 = get_relayout_candidate_type (TREE_TYPE (lhs)); + srtype *t2 = get_relayout_candidate_type (TREE_TYPE (rhs)); ++ ++ if (!t1 || !t2 || !t1->semi_relayout || !t2->semi_relayout) ++ return false; ++ + if (t1 != t2) + return false; + +@@ -7608,26 +7614,24 @@ ipa_struct_reorg::rewrite_assign (gassign *stmt, gimple_stmt_iterator *gsi) + return false; + + /* The two operands always have pointer/reference type. */ +- if (struct_layout_optimize_level >= SEMI_RELAYOUT) ++ if (struct_layout_optimize_level >= SEMI_RELAYOUT ++ && (is_semi_relayout_candidate (rhs1) ++ || is_semi_relayout_candidate (rhs2))) + { +- if (is_semi_relayout_candidate (rhs1) +- || is_semi_relayout_candidate (rhs2)) ++ for (unsigned i = 0; ++ i < max_split && newrhs1[i] &&newrhs2[i]; i++) + { +- for (unsigned i = 0; +- i < max_split && newrhs1[i] &&newrhs2[i]; i++) +- { +- srtype *type = get_semi_relayout_candidate_type (rhs1); +- if (!type) +- type = get_semi_relayout_candidate_type (rhs2); +- gcc_assert (type != NULL); +- tree res = rewrite_pointer_diff (gsi, newrhs1[i], +- newrhs2[i], type); +- gimple *g = gimple_build_assign (gimple_assign_lhs (stmt), +- res); +- gsi_insert_before (gsi, g, GSI_SAME_STMT); +- } +- remove = true; ++ srtype *type = get_semi_relayout_candidate_type (rhs1); ++ if (!type) ++ type = get_semi_relayout_candidate_type (rhs2); ++ gcc_assert (type != NULL); ++ tree res = rewrite_pointer_diff (gsi, newrhs1[i], ++ newrhs2[i], type); ++ gimple *g = gimple_build_assign (gimple_assign_lhs (stmt), ++ res); ++ gsi_insert_before (gsi, g, GSI_SAME_STMT); + } ++ remove = true; + } + else + { +@@ -8710,7 +8714,7 @@ ipa_struct_reorg::check_and_prune_struct_for_semi_relayout (void) + continue; + } + if (type->has_alloc_array == 0 || type->has_alloc_array == 1 +- || type->has_alloc_array == -1) ++ || type->has_alloc_array == -1 || type->has_alloc_array == -3) + { + if (dump_file) + { +diff --git a/gcc/params.opt b/gcc/params.opt +index 6b73f2056..1ba269967 100644 +--- a/gcc/params.opt ++++ b/gcc/params.opt +@@ -990,5 +990,5 @@ Target size of pointer compression. + + -param=param-relayout-bucket-num= + Common Joined UInteger Var(param_relayout_bucket_num) Init(15) IntegerRange(1, 20) Param Optimization +-Relayout num of bucket ++Relayout num of bucket. + ; This comment is to ensure we retain the blank line above. +-- +2.27.0 + diff --git a/gcc.spec b/gcc.spec index 07d6d989c2954f335385fd07e2f3d535c6d0910b..feefe63dfc51570a6eec48bf701aa11d7d85d60e 100644 --- a/gcc.spec +++ b/gcc.spec @@ -61,7 +61,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: 13 +Release: 14 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gcc.gnu.org @@ -169,6 +169,8 @@ Patch49: 0049-PointerCompression-Structure-pointer-compression.patch Patch50: 0050-PointerCompression-Adaptation.patch Patch51: 0051-DFE-fixme.patch Patch52: 0052-SemiRelayout-structure-Semi-Relayout.patch +Patch53: 0053-Loop-distribution-and-SLP-Bugfix.patch +Patch54: 0054-Semi-relayout-Bugfix.patch %global gcc_target_platform %{_arch}-linux-gnu @@ -668,6 +670,8 @@ This package includes jemalloc, mathlib and stringlib %patch50 -p1 %patch51 -p1 %patch52 -p1 +%patch53 -p1 +%patch54 -p1 %build @@ -2656,6 +2660,12 @@ end %endif %changelog +* Thu Jul 7 2022 benniaobufeijiushiji - 10.3.1-14 +- Type:Bugfix +- ID:NA +- SUG:NA +- DESC:Bugfix for loop-distribution, transpose-slp and semi-relayout. + * Wed Jun 29 2022 dingguangya - 10.3.1-13 - Type:POC test - ID:NA