Home | History | Annotate | Download | only in perf-training
      1 if(LLVM_BUILD_INSTRUMENTED)
      2   if (CMAKE_CFG_INTDIR STREQUAL ".")
      3     set(LLVM_BUILD_MODE ".")
      4   else ()
      5     set(LLVM_BUILD_MODE "%(build_mode)s")
      6   endif ()
      7 
      8   string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
      9 
     10   configure_lit_site_cfg(
     11     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
     12     ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     13     )
     14 
     15   add_lit_testsuite(generate-profraw "Generating clang PGO data"
     16     ${CMAKE_CURRENT_BINARY_DIR}
     17     DEPENDS clang clear-profraw
     18     )
     19 
     20   add_custom_target(clear-profraw
     21     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR}
     22     COMMENT "Clearing old profraw data")
     23 
     24   if(NOT LLVM_PROFDATA)
     25     find_program(LLVM_PROFDATA llvm-profdata)
     26   endif()
     27 
     28   if(NOT LLVM_PROFDATA)
     29     message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
     30   endif()
     31 
     32   add_custom_target(generate-profdata
     33     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
     34     COMMENT "Merging profdata"
     35     DEPENDS generate-profraw)
     36 endif()
     37