[compiler-rt] [clang] [clang-tools-extra] [PGO] Exposing PGO's Counter Reset and File Dumping APIs (PR #76471)
Qiongsi Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 28 17:07:27 PST 2023
================
@@ -0,0 +1,17 @@
+// RUN: %clang_pgogen -o %t %s
+// RUN: not %t
+// RUN: %clang -o %t %s
+// RUN: %t
+
+__attribute__((weak)) void __llvm_profile_reset_counters(void);
+
+__attribute__((noinline)) int bar() { return 4; }
+int foo() {
+ if (__llvm_profile_reset_counters) {
+ __llvm_profile_reset_counters();
+ return 0;
+ }
+ return bar();
----------------
qiongsiwu wrote:
Ah good point! I think neither `foo` or `bar` is necessary. The code is simplified.
https://github.com/llvm/llvm-project/pull/76471
More information about the cfe-commits
mailing list