[clang-tools-extra] [clang] [compiler-rt] [PGO] Exposing PGO's Counter Reset and File Dumping APIs (PR #76471)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 14:10: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();
----------------
snehasish wrote:

Do we need bar or can we just return 1 here (and remove the subtraction below)?  Perhaps the no-inline just needs to be applied to foo then.

https://github.com/llvm/llvm-project/pull/76471


More information about the llvm-commits mailing list