From cae11fd7cf6dbd9374d25a02189c0b85cac6e765 Mon Sep 17 00:00:00 2001 From: huang-xiaoquan Date: Mon, 29 Apr 2024 14:53:18 +0800 Subject: [PATCH] [BUGFIX] StructReorderFields-Fix-gimple-call-not-rewritten. --- ...Fields-Fix-gimple-call-not-rewritten.patch | 48 +++++++++++++++++++ gcc.spec | 8 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch diff --git a/0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch b/0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch new file mode 100644 index 0000000..76697e2 --- /dev/null +++ b/0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch @@ -0,0 +1,48 @@ +From 302b7e15d6308c29c215db4c9901342e1106381a Mon Sep 17 00:00:00 2001 +From: huang-xiaoquan +Date: Mon, 29 Apr 2024 11:00:12 +0800 +Subject: [PATCH] [StructReorderFields] Fix gimple call not rewritten due to + empty function node + +Add parameter type escape for empty functions or inline functions. +--- + gcc/ipa-struct-reorg/ipa-struct-reorg.cc | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/gcc/ipa-struct-reorg/ipa-struct-reorg.cc b/gcc/ipa-struct-reorg/ipa-struct-reorg.cc +index e08577c0c..2257d3528 100644 +--- a/gcc/ipa-struct-reorg/ipa-struct-reorg.cc ++++ b/gcc/ipa-struct-reorg/ipa-struct-reorg.cc +@@ -4366,6 +4366,17 @@ ipa_struct_reorg::maybe_record_call (cgraph_node *node, gcall *stmt) + + argtype = argtype ? TREE_CHAIN (argtype) : NULL_TREE; + } ++ ++ /* Types escapes via a argument at empty or inlined function. */ ++ cgraph_node *callee = node->get_edge (stmt)->callee; ++ if (!gimple_call_builtin_p (stmt, BUILT_IN_FREE) ++ && gimple_call_num_args (stmt) ++ && callee && (!callee->has_gimple_body_p () || callee->inlined_to)) ++ { ++ for (unsigned i = 0; i < gimple_call_num_args (stmt); i++) ++ mark_type_as_escape (TREE_TYPE (gimple_call_arg (stmt, i)), ++ escape_var_arg_function); ++ } + } + + void +@@ -8068,6 +8079,11 @@ ipa_struct_reorg::rewrite_functions (void) + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "\nNo rewrite:\n"); ++ if (current_function_decl == NULL) ++ { ++ fprintf (dump_file, "\ncurrent_function_decl == NULL\n"); ++ continue; ++ } + if (current_function_decl) + dump_function_to_file (current_function_decl, dump_file, + dump_flags | TDF_VOPS); +-- +2.33.0 + diff --git a/gcc.spec b/gcc.spec index 970d81d..1bad0e8 100644 --- a/gcc.spec +++ b/gcc.spec @@ -2,7 +2,7 @@ %global gcc_major 12 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 27 +%global gcc_release 28 %global _unpackaged_files_terminate_build 0 %global _performance_build 1 @@ -198,6 +198,7 @@ Patch57: 0057-AutoFdo-Fix-memory-leaks-in-autofdo.patch Patch86: 0086-Modfify-cost-calculation-for-dealing-with-equivalenc.patch Patch87: 0087-Add-cost-calculation-for-reg-equivalence-invariants.patch Patch88: 0088-BUGFIX-Fix-the-configure-file-of-BOLT.patch +Patch89: 0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch # Part 3000 ~ 4999 %ifarch loongarch64 @@ -857,6 +858,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch86 -p1 %patch87 -p1 %patch88 -p1 +%patch89 -p1 %ifarch loongarch64 %patch3001 -p1 @@ -3252,6 +3254,10 @@ end %doc rpm.doc/changelogs/libcc1/ChangeLog* %changelog +* Mon Apr 29 2024 huang-xiaoquan - 12.3.1-28 +- Type: BUGFIX +- DESC: StructReorderFields-Fix-gimple-call-not-rewritten. + * Fri Apr 26 2024 Zhenyu Zhao - 12.3.1-27 - Type: BUGFIX - DESC: Update the configure file for BOLT. -- Gitee