Skip to content

Commit c1ea19f

Browse files
committed
Use -fprofile-use= when TEST_SUITE_USE_IR_PGO is enabled
`TEST_SUITE_USE_IR_PGO` changes the test-suite to use `-fprofile-generate=xxx` (instead of `-fprofile-instr-gen=xxx`). This changes cmake to also use `-fprofile-use=xxx` (instead of `-fprofile-instr-use=xxx`). This change is cosmetic: It turns out `-fprofile-instr-use` does automatically detect the profile format used and works either way. But picking the matching use-flag can avoid confusion for people inspecting the compiler flags. Differential Revision: https://reviews.llvm.org/D134199
1 parent 48adf16 commit c1ea19f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmake/modules/TestSuite.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ function(llvm_test_executable_no_test target)
5454
append_target_flags(LINK_LIBRARIES ${target} ${LDFLAGS})
5555
set(target_path ${CMAKE_CURRENT_BINARY_DIR}/${target})
5656
if(TEST_SUITE_PROFILE_USE)
57-
append_target_flags(COMPILE_FLAGS ${target} -fprofile-instr-use=${target_path}.profdata)
58-
append_target_flags(LINK_LIBRARIES ${target} -fprofile-instr-use=${target_path}.profdata)
57+
if(TEST_SUITE_USE_IR_PGO)
58+
append_target_flags(COMPILE_FLAGS ${target} -fprofile-use=${TEST_SUITE_PROFILE_PATH}/${target}.profdata)
59+
append_target_flags(LINK_LIBRARIES ${target} -fprofile-use=${TEST_SUITE_PROFILE_PATH}/${target}.profdata)
60+
else()
61+
append_target_flags(COMPILE_FLAGS ${target} -fprofile-instr-use=${TEST_SUITE_PROFILE_PATH}/${target}.profdata)
62+
append_target_flags(LINK_LIBRARIES ${target} -fprofile-instr-use=${TEST_SUITE_PROFILE_PATH}/${target}.profdata)
63+
endif()
5964
endif()
6065

6166
llvm_codesign(${target})

0 commit comments

Comments
 (0)