[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

At the moment if LLVM_BUILD_INSTRUMENTED is set to True 
one has to set LLVM_PROFTDATA even if it's not really used 
(because of message(FATAL_ERROR ...)). 
Building the instrumented version of Clang can be useful even if 
one doesn't plan to build the target generate-profdata
(currently that target would only compile utils/perf-training/cxx/hello_world.cpp).
For example, one can run the instrumented version of Clang 
via a separate build system against a different codebase, 
collect/analyze the profiles and merge them by llvm-profdata later.

Differential revision: https://reviews.llvm.org/D38859

llvm-svn: 315665
This commit is contained in:
Alexander Shaposhnikov 2017-10-13 03:21:39 +00:00
parent ce2f5fdbb8
commit 0141e556f5
1 changed files with 6 additions and 6 deletions

View File

@ -30,13 +30,13 @@ if(LLVM_BUILD_INSTRUMENTED)
endif()
if(NOT LLVM_PROFDATA)
message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to llvm-profdata")
else()
add_custom_target(generate-profdata
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Merging profdata"
DEPENDS generate-profraw)
endif()
add_custom_target(generate-profdata
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Merging profdata"
DEPENDS generate-profraw)
endif()
find_program(DTRACE dtrace)