Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion clang/utils/perf-training/bolt.lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ from lit import Test
import lit.formats
import lit.util
import os
import re
import subprocess

clang_bolt_mode = config.clang_bolt_mode.lower()
Expand All @@ -20,9 +21,13 @@ elif clang_bolt_mode == "perf":
else:
assert 0, "Unsupported CLANG_BOLT_MODE variable"

config.clang = perf_wrapper + os.path.realpath(
clang_nowrapper = os.path.realpath(
lit.util.which(clang_binary, config.clang_tools_dir)
).replace("\\", "/")
config.clang = perf_wrapper + clang_nowrapper
config.cmake_compiler_args = "-DCMAKE_C_COMPILER='{0}' -DCMAKE_CXX_COMPILER='{0};--driver-mode=g++'".format(
re.sub(r"\s+", ";", clang_nowrapper)
)

config.name = "Clang Perf Training"
config.suffixes = [
Expand All @@ -49,6 +54,8 @@ config.substitutions.append(("%clang_cpp", f" {config.clang} --driver-mode=g++ "
config.substitutions.append(("%clang_skip_driver", config.clang))
config.substitutions.append(("%clang", config.clang))
config.substitutions.append(("%test_root", config.test_exec_root))
config.substitutions.append(("%cmake_compiler_args", config.cmake_compiler_args))
config.substitutions.append(('%cmake_generator', config.cmake_generator))
config.substitutions.append(('%cmake', config.cmake_exe))
config.substitutions.append(('%llvm_src_dir', config.llvm_src_dir))
config.substitutions.append(('%perf_wrapper', perf_wrapper))
5 changes: 5 additions & 0 deletions clang/utils/perf-training/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ cc1_wrapper = '%s %s/perf-helper.py cc1' % (config.python_exe, config.perf_helpe

use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
config.test_format = lit.formats.ShTest(use_lit_shell == "0")
config.cmake_compiler_args = '-DCMAKE_C_COMPILER="{0}" -DCMAKE_CXX_COMPILER="{0};--driver-mode=g++"'.format(
config.clang.replace(' ', ';')
)
config.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=g++ %s ' % (config.clang, sysroot_flags)))
config.substitutions.append( ('%clang_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
config.substitutions.append( ('%clang', '%s %s ' % (config.clang, sysroot_flags) ) )
config.substitutions.append( ('%test_root', config.test_exec_root ) )
config.substitutions.append( ('%cmake_compiler_args', config.cmake_compiler_args))
config.substitutions.append( ('%cmake_generator', config.cmake_generator ) )
config.substitutions.append( ('%cmake', config.cmake_exe ) )
config.substitutions.append( ('%llvm_src_dir', config.llvm_src_dir ) )
config.substitutions.append( ('%perf_wrapper', '' ) )

config.environment['LLVM_PROFILE_FILE'] = 'perf-training-%4m.profraw'

4 changes: 2 additions & 2 deletions clang/utils/perf-training/llvm-support/build.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
RUN: %cmake -G %cmake_generator -B %t -S %llvm_src_dir -DCMAKE_C_COMPILER=%clang -DCMAKE_CXX_COMPILER=%clang -DCMAKE_CXX_FLAGS="--driver-mode=g++" -DCMAKE_BUILD_TYPE=Release
RUN: %cmake --build %t -v --target LLVMSupport
RUN: %cmake -G %cmake_generator -B %t -S %llvm_src_dir %cmake_compiler_args -DCMAKE_BUILD_TYPE=Release
RUN: %perf_wrapper %cmake --build %t -v --target LLVMSupport
Loading