From 73127104a245052cd5cf29cdaaca3e5c32c70348 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 28 Feb 2025 10:03:49 +0000 Subject: automatic import of gcc --- ...orderFields-Fix-gimple-call-not-rewritten.patch | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 0089-StructReorderFields-Fix-gimple-call-not-rewritten.patch (limited to '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 + -- cgit v1.2.3