!421 [BUGFIX] StructReorderFields-Fix-gimple-call-not-rewritten

From: @huang-xiaoquan 
Reviewed-by: @xiongzhou4 
Signed-off-by: @xiongzhou4
This commit is contained in:
openeuler-ci-bot 2024-04-29 08:12:05 +00:00 committed by Gitee
commit f5240a8594
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 302b7e15d6308c29c215db4c9901342e1106381a Mon Sep 17 00:00:00 2001
From: huang-xiaoquan <huangxiaoquan1@huawei.com>
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

View File

@ -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 <huangxiaoquan1@huawei.com> - 12.3.1-28
- Type: BUGFIX
- DESC: StructReorderFields-Fix-gimple-call-not-rewritten.
* Fri Apr 26 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 12.3.1-27
- Type: BUGFIX
- DESC: Update the configure file for BOLT.