Skip to content

Commit 13132f9

Browse files
committed
Pass -fdebug-info-for-profiling and check for clang
1 parent 2c5b25b commit 13132f9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,13 +1218,17 @@ if (LLVM_BUILD_INSTRUMENTED)
12181218
CMAKE_SHARED_LINKER_FLAGS)
12191219
endif()
12201220
elseif(uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "CSSPGO")
1221-
append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls -fpseudo-probe-for-profiling"
1222-
CMAKE_CXX_FLAGS
1223-
CMAKE_C_FLAGS)
1224-
if(NOT LINKER_IS_LLD_LINK)
1225-
append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls -fpseudo-probe-for-profiling"
1226-
CMAKE_EXE_LINKER_FLAGS
1227-
CMAKE_SHARED_LINKER_FLAGS)
1221+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1222+
append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls -fpseudo-probe-for-profiling -fdebug-info-for-profiling"
1223+
CMAKE_CXX_FLAGS
1224+
CMAKE_C_FLAGS)
1225+
if(NOT LINKER_IS_LLD_LINK)
1226+
append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls -fpseudo-probe-for-profiling -fdebug-info-for-profiling"
1227+
CMAKE_EXE_LINKER_FLAGS
1228+
CMAKE_SHARED_LINKER_FLAGS)
1229+
endif()
1230+
else()
1231+
message(FATAL_ERROR "LLVM_BUILD_INSTRUMENTED=CSSPGO can only be specified when compiling with clang")
12281232
endif()
12291233
else()
12301234
append("-fprofile-instr-generate=\"${LLVM_PROFILE_FILE_PATTERN}\""

0 commit comments

Comments
 (0)