Skip to content

[build-script] Add clang PGO support #4977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2016
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
11 changes: 11 additions & 0 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,12 @@ class BuildScriptInvocation(object):
if args.dry_run:
impl_args += ["--dry-run"]

if args.clang_profile_instr_use:
impl_args += [
"--clang-profile-instr-use=%s" %
os.path.abspath(args.clang_profile_instr_use)
]

if args.lit_args:
impl_args += ["--llvm-lit-args=%s" % args.lit_args]

Expand Down Expand Up @@ -1985,6 +1991,11 @@ details of the setups of other systems or automated environments.""")
const='full',
dest='lto_type')

parser.add_argument(
"--clang-profile-instr-use",
help="profile file to use for clang PGO",
metavar="PATH")

default_max_lto_link_job_counts = host.max_lto_link_job_counts()
parser.add_argument(
"--llvm-max-parallel-lto-link-jobs",
Expand Down
7 changes: 7 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ KNOWN_SETTINGS=(
user-config-args "" "**Renamed to --extra-cmake-options**: User-supplied arguments to cmake when used to do configuration."
only-execute "all" "Only execute the named action (see implementation)"
llvm-lit-args "" "If set, override the lit args passed to LLVM"
clang-profile-instr-use "" "If set, profile file to use for clang PGO"
coverage-db "" "If set, coverage database to use when prioritizing testing"
build-toolchain-only "" "If set, only build the necessary tools to build an external toolchain"
)
Expand Down Expand Up @@ -740,6 +741,12 @@ function set_build_options_for_host() {
)
fi

if [[ "${CLANG_PROFILE_INSTR_USE}" ]]; then
llvm_cmake_options+=(
-DLLVM_PROFDATA_FILE="${CLANG_PROFILE_INSTR_USE}"
)
fi

swift_cmake_options+=(
-DCOVERAGE_DB="${COVERAGE_DB}"
)
Expand Down