代码拉取完成,页面将自动刷新
From 25f3b77d288e26b198c7836c3ed9b4fb0a85a48a Mon Sep 17 00:00:00 2001
From: liyancheng <412998149@qq.com>
Date: Mon, 16 Dec 2024 15:52:22 +0800
Subject: [PATCH] [CSPGO] Update the gate of cspgo
Update gate to allow CSPGO to be enabled after PGO
---
gcc/tree-profile.cc | 59 +++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
index ace1fe31c..3c57a0a75 100644
--- a/gcc/tree-profile.cc
+++ b/gcc/tree-profile.cc
@@ -1108,34 +1108,47 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return (flag_csprofile_generate || flag_csprofile_use);
- }
- /* The main process of cspgo is in csprofile_transform, execute does not need
- to do anything. */
- virtual unsigned int execute (function *)
- {
- if (!profile_data_prefix)
- error ("profile_data_prefix must set when using cspgo.");
+ if (flag_csprofile_generate || flag_csprofile_use)
+ {
+ int ret = true;
+ if (!profile_data_prefix)
+ {
+ error ("pgo profile path must set when using cspgo.");
+ ret = false;
+ }
- if (!csprofile_data_prefix)
- error ("csprofile_data_prefix must set when using cspgo.");
+ if (!csprofile_data_prefix)
+ {
+ error ("cspgo profile path must set when using cspgo.");
+ ret = false;
+ }
- if (!flag_cfgo_profile_use)
- error ("cspgo must used with cfgo-pgo.");
+ if (!(flag_cfgo_profile_use || flag_profile_use))
+ {
+ error ("cspgo must used with cfgo-pgo or pgo.");
+ ret = false;
+ }
- /* Just compare canonical pathnames. */
- char* cfgo_pgo_path = lrealpath (profile_data_prefix);
- char* cfgo_cspgo_path = lrealpath (csprofile_data_prefix);
- bool files_differ = filename_cmp (cfgo_pgo_path, cfgo_cspgo_path);
- if (!files_differ)
- {
- error ("pgo and cspgo path must different between %s and %s",
- cfgo_pgo_path, cfgo_cspgo_path);
+ /* pgo and cspgo path must different. */
+ char* cfgo_pgo_path = lrealpath (profile_data_prefix);
+ char* cfgo_cspgo_path = lrealpath (csprofile_data_prefix);
+ bool files_differ = filename_cmp (cfgo_pgo_path, cfgo_cspgo_path);
+ if (!files_differ)
+ {
+ error ("pgo and cspgo path must different between %s and %s",
+ cfgo_pgo_path, cfgo_cspgo_path);
+ ret = false;
+ }
+ free (cfgo_pgo_path);
+ free (cfgo_cspgo_path);
+
+ return ret;
}
- free (cfgo_pgo_path);
- free (cfgo_cspgo_path);
- return 0;
+ return false;
}
+ /* The main process of cspgo is in csprofile_transform, execute does not need
+ to do anything. */
+ virtual unsigned int execute (function *) { return 0; }
}; // class pass_ipa_csprofile
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。