[clang] [llvm] [Clang][CMake] Add CSSPGO support to LLVM_BUILD_INSTRUMENTED (PR #79942)

Amir Ayupov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 14:50:21 PDT 2025


================
@@ -1217,6 +1217,15 @@ if (LLVM_BUILD_INSTRUMENTED)
         CMAKE_EXE_LINKER_FLAGS
         CMAKE_SHARED_LINKER_FLAGS)
     endif()
+  elseif(uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "CSSPGO")
+    append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls -fpseudo-probe-for-profiling"
+      CMAKE_CXX_FLAGS
+      CMAKE_C_FLAGS)
+    if(NOT LINKER_IS_LLD_LINK)
----------------
aaupov wrote:

Note we're setting CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS only if the linker is not lld, perhaps in case the flags aren't picked up from IR. I'll keep it for consistency with the rest of instrumentation modes.

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


More information about the cfe-commits mailing list