Skip to content

Commit d6ec32c

Browse files
w2yehiaWael Yehia
andauthored
[profile] runtime counter relocation is needed on windows-msvc targets (#127858)
Continuous profile syncing is supported on windows, and it also relies on runtime counter relocation (based on this test [1]) Thanks to @anhtuyenibm for pointing it out to me. [1] https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c --------- Co-authored-by: Wael Yehia <[email protected]>
1 parent 3191524 commit d6ec32c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,8 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
762762
else {
763763
CmdArgs.push_back("-fprofile-continuous");
764764
// Platforms that require a bias variable:
765-
if (T.isOSBinFormatELF() || T.isOSAIX()) {
765+
if (T.isOSBinFormatELF() || T.isOSAIX() ||
766+
T.isKnownWindowsMSVCEnvironment()) {
766767
CmdArgs.push_back("-mllvm");
767768
CmdArgs.push_back("-runtime-counter-relocation");
768769
}

clang/test/Driver/fprofile-continuous.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// RUN: %clang --target=powerpc64-ibm-aix -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC
88
// RUN: %clang --target=x86_64-unknown-fuchsia -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC
9+
// RUN: %clang --target=x86_64-windows-msvc -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC
910
// RELOC: "-cc1" {{.*}} "-fprofile-continuous" "-mllvm" "-runtime-counter-relocation"
1011

1112
// 2) test -fprofile-continuous with cs-profile-generate and -fprofile-instr-generate

0 commit comments

Comments
 (0)