summaryrefslogtreecommitdiff
path: root/0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-02-28 10:03:49 +0000
committerCoprDistGit <infra@openeuler.org>2025-02-28 10:03:49 +0000
commit73127104a245052cd5cf29cdaaca3e5c32c70348 (patch)
tree8e28b63e478c43c252f18b49836dff7313affe54 /0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch
parent49d3feaf4665cdb07576fc1a2382a4d82a612d35 (diff)
automatic import of gccopeneuler24.03_LTS_SP1
Diffstat (limited to '0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch')
-rw-r--r--0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch b/0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch
new file mode 100644
index 0000000..20cf27b
--- /dev/null
+++ b/0096-Bugfix-Autofdo-use-PMU-sampling-set-num-eauals-den.patch
@@ -0,0 +1,45 @@
+From 06e86b362f74ba0706fb5d8377f78d24b658c300 Mon Sep 17 00:00:00 2001
+From: zhenyu--zhao_admin <zhaozhenyu17@huawei.com>
+Date: Sat, 18 May 2024 12:22:23 +0800
+Subject: [PATCH] [Bugfix] Autofdo use PMU sampling set num eauals den
+
+---
+ gcc/final.cc | 2 +-
+ gcc/tree-cfg.cc | 8 ++++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/final.cc b/gcc/final.cc
+index f66c9d155..e4bfceabc 100644
+--- a/gcc/final.cc
++++ b/gcc/final.cc
+@@ -4604,7 +4604,7 @@ dump_profile_to_elf_sections ()
+ /* Return if no feedback data. */
+ if (!flag_profile_use && !flag_auto_profile)
+ {
+- error ("-fauto-bolt should use with -profile-use or -fauto-profile");
++ error ("-fauto-bolt should use with -fprofile-use or -fauto-profile");
+ return;
+ }
+
+diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
+index 05fc45147..48b52f785 100644
+--- a/gcc/tree-cfg.cc
++++ b/gcc/tree-cfg.cc
+@@ -9741,6 +9741,14 @@ execute_fixup_cfg (void)
+ /* Same scaling is also done by ipa_merge_profiles. */
+ profile_count num = node->count;
+ profile_count den = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
++ /* When autofdo uses PMU as the sampling unit, the number of
++ node can not be obtained directly, sometimes it will be zero,
++ but the execution number for function should at least be 1. We
++ set num be den here to make sure the num will not decrease. */
++ if (num == profile_count::zero ().afdo () && den.quality () == profile_quality::AFDO)
++ {
++ num = den;
++ }
+ bool scale = num.initialized_p () && !(num == den);
+ auto_bitmap dce_ssa_names;
+
+--
+2.33.0
+