Skip to content

Commit cce25f0

Browse files
author
Qiongsi Wu
committed
Address review comments
1 parent 13a4bb3 commit cce25f0

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

compiler-rt/include/profile/instr_prof_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ int __llvm_orderfile_dump(void);
5555

5656
#else
5757
#define __llvm_profile_reset_counters()
58-
#define __llvm_profile_dump()
59-
#define __llvm_orderfile_dump()
58+
#define __llvm_profile_dump() (0)
59+
#define __llvm_orderfile_dump() (0)
6060
#endif
6161

6262
#ifdef __cplusplus

compiler-rt/lib/profile/InstrProfiling.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@
1212
#include "InstrProfilingPort.h"
1313
#include <stdio.h>
1414

15+
// Make sure __LLVM_INSTR_PROFILE_GENERATE is always defined before
16+
// including instr_prof_interface.h so the interface functions are
17+
// declared correctly for the runtime. Additionally, make sure
18+
// that __LLVM_INSTR_PROFILE_GENERATE is undefined only when it is
19+
// not explicitly defined somewhere else.
20+
#ifndef __LLVM_INSTR_PROFILE_GENERATE
1521
#define __LLVM_INSTR_PROFILE_GENERATE
1622
#include "profile/instr_prof_interface.h"
23+
#undef __LLVM_INSTR_PROFILE_GENERATE
24+
#else
25+
#include "profile/instr_prof_interface.h"
26+
#endif
1727

1828
#define INSTR_PROF_VISIBILITY COMPILER_RT_VISIBILITY
1929
#include "profile/InstrProfData.inc"

compiler-rt/test/profile/instrprof-api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// RUN: %clang_profgen %s -S -emit-llvm -o - | FileCheck %s --check-prefix=PROFGEN
1+
// RUN: %clang_profgen %s --target=ppc64le-unknown-linux-gnu -S \
2+
// RUN: -emit-llvm -o - | FileCheck %s --check-prefix=PROFGEN
23
// RUN: %clang_profgen -o %t %s
34
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
45
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
5-
// RUN: %clang_profuse=%t.profdata %s -S -emit-llvm -o - | FileCheck %s --check-prefix=PROFUSE
6+
// RUN: %clang_profuse=%t.profdata %s --target=ppc64le-unknown-linux-gnu -S \
7+
// RUN: -emit-llvm -o - | FileCheck %s --check-prefix=PROFUSE
68
#include "profile/instr_prof_interface.h"
79

810
__attribute__((noinline)) int bar() { return 4; }

0 commit comments

Comments
 (0)