21 Star 27 Fork 151

src-openEuler/gcc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0327-Bugfix-Adjust-the-same-gate-to-use-struct-option.patch 2.99 KB
一键复制 编辑 原始数据 按行查看 历史
huangxiaoquan 提交于 2024-12-16 14:56 +08:00 . Adjust the same gate to use struct option.
From 861ddfd90d86215a573a7614f49d572f1e03be6f Mon Sep 17 00:00:00 2001
From: huang-xiaoquan <huangxiaoquan1@huawei.com>
Date: Mon, 16 Dec 2024 11:34:06 +0800
Subject: [PATCH] [Bugfix] Adjust the same gate to use struct option
---
gcc/gimple-ssa-warn-access.cc | 7 ++++++-
gcc/ipa-free-lang-data.cc | 5 +++--
gcc/symbol-summary.h | 8 +++++++-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index a24645783..3d80590ee 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -56,6 +56,9 @@
#include "attr-fnspec.h"
#include "pointer-query.h"
+/* Check whether in C language or LTO with only C language. */
+extern bool lang_c_p (void);
+
/* Return true if tree node X has an associated location. */
static inline location_t
@@ -2198,7 +2201,9 @@ pass_waccess::gate (function *)
In pass waccess, it will traverse all SSA and cause ICE
when handling these unused SSA. So temporarily disable
pass waccess when enable structure optimizations. */
- if (flag_ipa_struct_reorg)
+ if (optimize >= 3 && flag_ipa_struct_reorg && !seen_error ()
+ && flag_lto_partition == LTO_PARTITION_ONE && lang_c_p ()
+ && (in_lto_p || flag_whole_program))
return false;
return (warn_free_nonheap_object
diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc
index 801e95cea..17e3f43b3 100644
--- a/gcc/ipa-free-lang-data.cc
+++ b/gcc/ipa-free-lang-data.cc
@@ -108,8 +108,9 @@ fld_simplified_type_name (tree type)
/* Simplify type will cause that struct A and struct A within
struct B are different type pointers, so skip it in structure
optimizations. */
- if (flag_ipa_struct_reorg && lang_c_p ()
- && flag_lto_partition == LTO_PARTITION_ONE)
+ if (optimize >= 3 && flag_ipa_struct_reorg && !seen_error ()
+ && flag_lto_partition == LTO_PARTITION_ONE && lang_c_p ()
+ && (in_lto_p || flag_whole_program))
return TYPE_NAME (type);
if (!TYPE_NAME (type) || TREE_CODE (TYPE_NAME (type)) != TYPE_DECL)
diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index 4f896f4e4..06a1c7fff 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -21,6 +21,10 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_SYMBOL_SUMMARY_H
#define GCC_SYMBOL_SUMMARY_H
+#include "diagnostic.h"
+/* Check whether in C language or LTO with only C language. */
+extern bool lang_c_p (void);
+
/* Base class for function_summary and fast_function_summary classes. */
template <class T>
@@ -109,7 +113,9 @@ protected:
: m_allocator.allocate ();
/* In structure optimizatons, we call memset to ensure that
the allocated memory is initialized to 0. */
- if (flag_ipa_struct_reorg)
+ if (optimize >= 3 && flag_ipa_struct_reorg && !seen_error ()
+ && flag_lto_partition == LTO_PARTITION_ONE && lang_c_p ()
+ && (in_lto_p || flag_whole_program))
memset (allocated, 0, sizeof (T));
return allocated;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gcc.git
git@gitee.com:src-openeuler/gcc.git
src-openeuler
gcc
gcc
master

搜索帮助