https://github.com/w2yehia created https://github.com/llvm/llvm-project/pull/127858
Continuous profiling syncing is [supported on windows,](https://github.com/llvm/llvm-project/pull/124353#issuecomment-2649075857) and it also relies on runtime counter relocation (based on this [test](https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c)) Thanks to @anhtuyenibm for pointing it out to me. >From 843f78e9826b037a7bfb0913728a11eb249f4181 Mon Sep 17 00:00:00 2001 From: Wael Yehia <wye...@ca.ibm.com> Date: Wed, 19 Feb 2025 06:25:16 +0000 Subject: [PATCH] [profile] runtime counter relocation is needed on windows-msvc targets --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/test/Driver/fprofile-continuous.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 96af466e067a8..3f76d034ee308 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -795,7 +795,7 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, else { CmdArgs.push_back("-fprofile-continuous"); // Platforms that require a bias variable: - if (T.isOSBinFormatELF() || T.isOSAIX()) { + if (T.isOSBinFormatELF() || T.isOSAIX() || T.isKnownWindowsMSVCEnvironment()) { CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-runtime-counter-relocation"); } diff --git a/clang/test/Driver/fprofile-continuous.c b/clang/test/Driver/fprofile-continuous.c index 81719fb70cb1e..cc8e56c8f9fe0 100644 --- a/clang/test/Driver/fprofile-continuous.c +++ b/clang/test/Driver/fprofile-continuous.c @@ -6,6 +6,7 @@ // RUN: %clang --target=powerpc64-ibm-aix -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC // RUN: %clang --target=x86_64-unknown-fuchsia -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC +// RUN: %clang --target=x86_64-windows-msvc -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC // RELOC: "-cc1" {{.*}} "-fprofile-continuous" "-mllvm" "-runtime-counter-relocation" // 2) test -fprofile-continuous with cs-profile-generate and -fprofile-instr-generate _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits