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

Snehasish Kumar via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 13:39:24 PST 2023


================
@@ -0,0 +1,26 @@
+// RUN: %clang_profgen %s -S -emit-llvm -o - | FileCheck %s --check-prefix=PROFGEN
+// RUN: %clang_profgen -o %t %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: %clang_profuse=%t.profdata %s -S -emit-llvm -o - | FileCheck %s --check-prefix=PROFUSE
+#include "profile/instr_profiling.h"
+
+__attribute__((noinline)) int bar() { return 4; }
+
+int foo() {
+  __llvm_profile_reset_counters();
----------------
snehasish wrote:

Can you also add a test with the weak linking approach to ensure that is unaffected?

(Maybe there exists one already but I'm not sure).

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


More information about the cfe-commits mailing list