Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 4234e38

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Delete support for compiler performance stats collection.
This wasn't used frequently enough to rationalize being so deeply woven into the build rules. A better approach might be to use an aspect that runs the same actions in parallel but with the necessary stats flags and collects the data files; while this would double the actions executed, it's better code-health wise. But I don't have any plans to do that in the near-term. PiperOrigin-RevId: 363887607
1 parent 027e180 commit 4234e38

File tree

9 files changed

+0
-454
lines changed

9 files changed

+0
-454
lines changed

swift/BUILD

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ bzl_library(
1515
],
1616
)
1717

18-
bzl_library(
19-
name = "stats",
20-
srcs = ["stats.bzl"],
21-
deps = [
22-
"//swift/internal:build_defs",
23-
],
24-
)
25-
2618
bzl_library(
2719
name = "repositories",
2820
srcs = ["repositories.bzl"],

swift/internal/compiling.bzl

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ load(":derived_files.bzl", "derived_files")
3131
load(
3232
":feature_names.bzl",
3333
"SWIFT_FEATURE_CACHEABLE_SWIFTMODULES",
34-
"SWIFT_FEATURE_COMPILE_STATS",
3534
"SWIFT_FEATURE_COVERAGE",
3635
"SWIFT_FEATURE_DBG",
3736
"SWIFT_FEATURE_DEBUG_PREFIX_MAP",
@@ -177,14 +176,6 @@ def compile_action_configs(
177176
actions = [swift_action_names.COMPILE],
178177
configurators = [_emit_objc_header_path_configurator],
179178
),
180-
181-
# Configure the location where compiler performance statistics are
182-
# dumped.
183-
swift_toolchain_config.action_config(
184-
actions = [swift_action_names.COMPILE],
185-
configurators = [_stats_output_dir_configurator],
186-
features = [SWIFT_FEATURE_COMPILE_STATS],
187-
),
188179
]
189180

190181
#### Compilation-mode-related flags
@@ -1062,10 +1053,6 @@ def _module_name_configurator(prerequisites, args):
10621053
"""Adds the module name flag to the command line."""
10631054
args.add("-module-name", prerequisites.module_name)
10641055

1065-
def _stats_output_dir_configurator(prerequisites, args):
1066-
"""Adds the compile stats output directory path to the command line."""
1067-
args.add("-stats-output-dir", prerequisites.stats_directory.path)
1068-
10691056
def _source_files_configurator(prerequisites, args):
10701057
"""Adds source files to the command line and required inputs."""
10711058
args.add_all(prerequisites.source_files)
@@ -1303,9 +1290,6 @@ def compile(
13031290
* `precompiled_module`: A `File` representing the explicit module
13041291
(`.pcm`) of the Clang module for the generated header, or `None` if
13051292
no explicit module was generated.
1306-
* `stats_directory`: A `File` representing the directory that contains
1307-
the timing statistics emitted by the compiler. If no stats were
1308-
requested, this field will be None.
13091293
* `swiftdoc`: The `.swiftdoc` file that was produced by the compiler.
13101294
* `swiftinterface`: The `.swiftinterface` file that was produced by
13111295
the compiler. If no interface file was produced (because the
@@ -1337,7 +1321,6 @@ def compile(
13371321
compile_outputs.swiftinterface_file,
13381322
compile_outputs.generated_header_file,
13391323
compile_outputs.indexstore_directory,
1340-
compile_outputs.stats_directory,
13411324
]) + compile_outputs.object_files + other_outputs
13421325

13431326
# Merge the providers from our dependencies so that we have one each for
@@ -1479,7 +1462,6 @@ def compile(
14791462
post_compile_results.additional_object_files
14801463
),
14811464
precompiled_module = precompiled_module,
1482-
stats_directory = compile_outputs.stats_directory,
14831465
swiftdoc = compile_outputs.swiftdoc_file,
14841466
swiftinterface = compile_outputs.swiftinterface_file,
14851467
swiftmodule = compile_outputs.swiftmodule_file,
@@ -1669,17 +1651,6 @@ def _declare_compile_outputs(
16691651
else:
16701652
swiftinterface_file = None
16711653

1672-
if is_feature_enabled(
1673-
feature_configuration = feature_configuration,
1674-
feature_name = SWIFT_FEATURE_COMPILE_STATS,
1675-
):
1676-
stats_directory = derived_files.stats_directory(
1677-
actions = actions,
1678-
target_name = target_name,
1679-
)
1680-
else:
1681-
stats_directory = None
1682-
16831654
# If requested, generate the Swift header for this library so that it can be
16841655
# included by Objective-C code that depends on it.
16851656
if generated_header_name:
@@ -1781,7 +1752,6 @@ def _declare_compile_outputs(
17811752
indexstore_directory = indexstore_directory,
17821753
object_files = object_files,
17831754
output_file_map = output_file_map,
1784-
stats_directory = stats_directory,
17851755
swiftdoc_file = swiftdoc_file,
17861756
swiftinterface_file = swiftinterface_file,
17871757
swiftmodule_file = swiftmodule_file,
@@ -2147,11 +2117,6 @@ def output_groups_from_compilation_outputs(compilation_outputs):
21472117
compilation_outputs.indexstore,
21482118
])
21492119

2150-
if compilation_outputs.stats_directory:
2151-
output_groups["swift_compile_stats_direct"] = depset([
2152-
compilation_outputs.stats_directory,
2153-
])
2154-
21552120
if compilation_outputs.swiftinterface:
21562121
output_groups["swiftinterface"] = depset([
21572122
compilation_outputs.swiftinterface,

swift/internal/derived_files.bzl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,6 @@ def _static_archive(actions, alwayslink, link_name):
186186
extension = "lo" if alwayslink else "a"
187187
return actions.declare_file("lib{}.{}".format(link_name, extension))
188188

189-
def _stats_directory(actions, target_name):
190-
"""Declares a directory that will contain timing statistics for a compile.
191-
192-
Args:
193-
actions: The context's actions object.
194-
target_name: The name of the target being built.
195-
196-
Returns:
197-
The declared `File`.
198-
"""
199-
return actions.declare_directory("{}.compile-stats".format(target_name))
200-
201189
def _swiftc_output_file_map(actions, target_name):
202190
"""Declares a file for the output file map for a compilation action.
203191
@@ -317,7 +305,6 @@ derived_files = struct(
317305
precompiled_module = _precompiled_module,
318306
reexport_modules_src = _reexport_modules_src,
319307
static_archive = _static_archive,
320-
stats_directory = _stats_directory,
321308
swiftc_output_file_map = _swiftc_output_file_map,
322309
swiftdoc = _swiftdoc,
323310
swiftinterface = _swiftinterface,

swift/internal/feature_names.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ SWIFT_FEATURE_COVERAGE = "swift.coverage"
4747
# `swift_test` output just a binary.
4848
SWIFT_FEATURE_BUNDLED_XCTESTS = "swift.bundled_xctests"
4949

50-
# If enabled, the Swift compiler will emit a directory containing JSON files
51-
# with timing information about the driver/frontend's actions. This directory
52-
# will be emitted as a default output when a Swift target is built directly, and
53-
# it will also be propagated in an output group named
54-
# `swift_compile_stats_direct`. Typically this output group will not be accessed
55-
# directly, but used by the `collect_swift_compile_stats` aspect to gather the
56-
# transitive stats for the entire build.
57-
SWIFT_FEATURE_COMPILE_STATS = "swift.compile_stats"
58-
5950
# If enabled, debug builds will use the `-debug-prefix-map` feature to remap the
6051
# current working directory to `.`, which permits debugging remote or sandboxed
6152
# builds.

swift/stats.bzl

Lines changed: 0 additions & 61 deletions
This file was deleted.

tools/compile_stats/BUILD

Lines changed: 0 additions & 6 deletions
This file was deleted.

tools/compile_stats/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

tools/compile_stats/build.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)