Skip to content

Commit 1af2b07

Browse files
authored
Merge pull request swiftlang#28767 from apple/revert-28702-only-one-dependency-file
2 parents 6d7726e + 73a46ce commit 1af2b07

File tree

5 files changed

+4
-69
lines changed

5 files changed

+4
-69
lines changed

include/swift/Driver/Compilation.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,6 @@ class Compilation {
257257
/// limit filelists will be used.
258258
size_t FilelistThreshold;
259259

260-
/// Because each frontend job outputs the same info in its .d file, only do it
261-
/// on the first job that actually runs. Write out dummies for the rest of the
262-
/// jobs. This hack saves a lot of time in the build system when incrementally
263-
/// building a project with many files. Record if a scheduled job has already
264-
/// added -emit-dependency-path.
265-
bool HaveAlreadyAddedDependencyPath = false;
266-
267-
/// When set, only the first scheduled frontend job gets the argument needed
268-
/// to produce a make-style dependency file. The other jobs create dummy files
269-
/// in the driver. This hack speeds up incremental compilation by reducing the
270-
/// time for the build system to read each dependency file, which are all
271-
/// identical. This optimization can be disabled by passing
272-
/// -disable-only-one-dependency-file on the command line.
273-
const bool OnlyOneDependencyFile;
274-
275260
/// Scaffolding to permit experimentation with finer-grained dependencies and
276261
/// faster rebuilds.
277262
const bool EnableFineGrainedDependencies;
@@ -324,7 +309,6 @@ class Compilation {
324309
bool SaveTemps = false,
325310
bool ShowDriverTimeCompilation = false,
326311
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
327-
bool OnlyOneDependencyFile = false,
328312
bool EnableFineGrainedDependencies = false,
329313
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
330314
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
@@ -443,14 +427,6 @@ class Compilation {
443427
return FilelistThreshold;
444428
}
445429

446-
/// Called to decide whether to add a dependency path argument, or whether to
447-
/// create a dummy file. Responds by invoking one of the two passed-in
448-
/// functions.
449-
void addDependencyPathOrCreateDummy(
450-
const CommandOutput &Output,
451-
function_ref<void(StringRef)> addDependencyPath,
452-
function_ref<void(StringRef)> createDummy);
453-
454430
UnifiedStatsReporter *getStatsReporter() const {
455431
return Stats.get();
456432
}

include/swift/Option/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ def enable_fine_grained_dependencies :
139139
Flag<["-"], "enable-fine-grained-dependencies">, Flags<[FrontendOption, HelpHidden]>,
140140
HelpText<"Experimental work-in-progress to be more selective about incremental recompilation">;
141141

142-
143-
def disable_only_one_dependency_file :
144-
Flag<["-"], "disable-only-one-dependency-file">, Flags<[DoesNotAffectIncrementalBuild]>,
145-
HelpText<"Disables incremental build optimization that only produces one dependencies file">;
146-
147142
def enable_source_range_dependencies :
148143
Flag<["-"], "enable-source-range-dependencies">, Flags<[]>,
149144
HelpText<"Try using source range information">;

lib/Driver/Compilation.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,13 @@ Compilation::Compilation(DiagnosticEngine &Diags,
121121
bool SaveTemps,
122122
bool ShowDriverTimeCompilation,
123123
std::unique_ptr<UnifiedStatsReporter> StatsReporter,
124-
bool OnlyOneDependencyFile,
125124
bool EnableFineGrainedDependencies,
126125
bool VerifyFineGrainedDependencyGraphAfterEveryImport,
127126
bool EmitFineGrainedDependencyDotFileAfterEveryImport,
128127
bool FineGrainedDependenciesIncludeIntrafileOnes,
129128
bool EnableSourceRangeDependencies,
130129
bool CompareIncrementalSchemes,
131-
StringRef CompareIncrementalSchemesPath
132-
)
130+
StringRef CompareIncrementalSchemesPath)
133131
: Diags(Diags), TheToolChain(TC),
134132
TheOutputInfo(OI),
135133
Level(Level),
@@ -151,16 +149,14 @@ Compilation::Compilation(DiagnosticEngine &Diags,
151149
ShowDriverTimeCompilation(ShowDriverTimeCompilation),
152150
Stats(std::move(StatsReporter)),
153151
FilelistThreshold(FilelistThreshold),
154-
OnlyOneDependencyFile(OnlyOneDependencyFile),
155152
EnableFineGrainedDependencies(EnableFineGrainedDependencies),
156153
VerifyFineGrainedDependencyGraphAfterEveryImport(
157154
VerifyFineGrainedDependencyGraphAfterEveryImport),
158155
EmitFineGrainedDependencyDotFileAfterEveryImport(
159156
EmitFineGrainedDependencyDotFileAfterEveryImport),
160157
FineGrainedDependenciesIncludeIntrafileOnes(
161158
FineGrainedDependenciesIncludeIntrafileOnes),
162-
EnableSourceRangeDependencies(EnableSourceRangeDependencies)
163-
{
159+
EnableSourceRangeDependencies(EnableSourceRangeDependencies) {
164160
if (CompareIncrementalSchemes)
165161
IncrementalComparator.emplace(
166162
// Ensure the references are to inst vars, NOT arguments
@@ -2036,19 +2032,3 @@ unsigned Compilation::countSwiftInputs() const {
20362032
++inputCount;
20372033
return inputCount;
20382034
}
2039-
2040-
void Compilation::addDependencyPathOrCreateDummy(
2041-
const CommandOutput &Output,
2042-
function_ref<void(StringRef)> addDependencyPath,
2043-
function_ref<void(StringRef)> createDummy) {
2044-
StringRef path =
2045-
Output.getAdditionalOutputForType(file_types::TY_Dependencies);
2046-
if (path.empty())
2047-
return;
2048-
if (HaveAlreadyAddedDependencyPath && OnlyOneDependencyFile)
2049-
createDummy(path);
2050-
else {
2051-
addDependencyPath(path);
2052-
HaveAlreadyAddedDependencyPath = true;
2053-
}
2054-
}

lib/Driver/Driver.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,11 +951,7 @@ Driver::buildCompilation(const ToolChain &TC,
951951
ArgList->hasArg(options::OPT_driver_time_compilation);
952952
std::unique_ptr<UnifiedStatsReporter> StatsReporter =
953953
createStatsReporter(ArgList.get(), Inputs, OI, DefaultTargetTriple);
954-
955-
const bool OnlyOneDependencyFile =
956-
!ArgList->hasArg(options::OPT_disable_only_one_dependency_file);
957954
// relies on the new dependency graph
958-
959955
const bool EnableFineGrainedDependencies =
960956
ArgList->hasArg(options::OPT_enable_fine_grained_dependencies);
961957

@@ -988,7 +984,6 @@ Driver::buildCompilation(const ToolChain &TC,
988984
SaveTemps,
989985
ShowDriverTimeCompilation,
990986
std::move(StatsReporter),
991-
OnlyOneDependencyFile,
992987
EnableFineGrainedDependencies,
993988
VerifyFineGrainedDependencyGraphAfterEveryImport,
994989
EmitFineGrainedDependencyDotFileAfterEveryImport,

lib/Driver/ToolChains.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include "llvm/Support/Process.h"
3535
#include "llvm/Support/Program.h"
3636

37-
#include <fstream>
38-
3937
using namespace swift;
4038
using namespace swift::driver;
4139
using namespace llvm::opt;
@@ -673,17 +671,8 @@ void ToolChain::JobContext::addFrontendSupplementaryOutputArguments(
673671
"mode!");
674672
}
675673

676-
C.addDependencyPathOrCreateDummy(
677-
Output,
678-
[&](StringRef) {
679-
addOutputsOfType(arguments, Output, Args, file_types::TY_Dependencies,
680-
"-emit-dependencies-path");
681-
},
682-
[&](StringRef dependencyFile) {
683-
// Create an empty file
684-
std::ofstream(dependencyFile.str().c_str());
685-
});
686-
674+
addOutputsOfType(arguments, Output, Args, file_types::TY_Dependencies,
675+
"-emit-dependencies-path");
687676
addOutputsOfType(arguments, Output, Args, file_types::TY_SwiftDeps,
688677
"-emit-reference-dependencies-path");
689678
addOutputsOfType(arguments, Output, Args, file_types::TY_SwiftRanges,

0 commit comments

Comments
 (0)