[clang] [compiler-rt] [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 06:49:21 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();
----------------
qiongsiwu wrote:

Yes absolutely! See https://github.com/llvm/llvm-project/pull/76471/files#diff-73a2e60ab2cfe7ec232978d767316cd70af176df9a4d98b12d6d5ed92a63324fR1. 

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


More information about the cfe-commits mailing list