mirror-llvm-project/flang/test/bolt.lit.cfg
Paul Osmialowski 44409a06cf
[flang][cmake][perf-training] Optimize flang with PGO and BOLT (#198863)
This is an attempt to replicate similar fearture already available to
clang. The changes in this patch were made with an intent to reuse as
much of existing infrastructure as possible. Namely, two-stage build
arrangement, perf-helper.py script and the means for building of the
instrumented binaries have all been incorporated into this approach.

It was deliberately chosen to optimize clang along with flang as they
are mostly working together in the final toolchain.

See the `llvm/docs/AdvancedBuilds.rst` documentation for more details.

Note that the attempt to optimize flang has exceeded one of the BOLT
limitations. The size of one of the statically allocated buffers needed
to be extended in this patch.
2026-06-24 18:01:07 +01:00

31 lines
790 B
Python

# -*- Python -*-
# Configuration used for performance training when optimizing flang with BOLT
import os
import lit.util
flang_bolt_mode = config.flang_bolt_mode.lower()
flang_binary = "flang"
perf_wrapper = f"{sys.executable} {config.perf_helper_dir}/perf-helper.py perf "
if flang_bolt_mode == "instrument":
perf_wrapper = ""
flang_binary = config.flang_bolt_name
elif flang_bolt_mode == "lbr":
perf_wrapper += " --lbr -- "
elif flang_bolt_mode == "perf":
perf_wrapper += " -- "
else:
assert 0, "Unsupported flang bolt mode"
flang_nowrapper = os.path.realpath(
lit.util.which(flang_binary, config.flang_opt_tools_dir)
).replace("\\", "/")
config.name = "Flang BOLT Training"
config.flang_exe = perf_wrapper + flang_nowrapper
config.llvm_profile_file = ''