Skip to content

Commit 099e461

Browse files
committed
Revert "Merge pull request swiftlang#34231 from CodaFi/skippy"
This reverts commit 4f49b6a, reversing changes made to cb70220.
1 parent af2cfc5 commit 099e461

File tree

7 files changed

+57
-194
lines changed

7 files changed

+57
-194
lines changed

include/swift/Driver/Action.h

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -130,40 +130,23 @@ class JobAction : public Action {
130130
class IncrementalJobAction : public JobAction {
131131
public:
132132
struct InputInfo {
133-
/// The status of an input known to the driver. These are used to affect
134-
/// the scheduling decisions made during an incremental build.
135-
///
136-
/// \Note The order of cases matters. They are ordered from least to
137-
/// greatest impact on the incremental build schedule.
138-
enum class Status {
139-
/// The input to this job is up to date.
133+
enum Status {
140134
UpToDate,
141-
/// The input to this job has changed in a way that requires this job to
142-
/// be rerun, but not in such a way that it requires a cascading rebuild.
143-
NeedsNonCascadingBuild,
144-
/// The input to this job has changed in a way that requires this job to
145-
/// be rerun, and in such a way that all jobs dependent upon this one
146-
/// must be scheduled as well.
147135
NeedsCascadingBuild,
148-
/// The input to this job was not known to the driver when it was last
149-
/// run.
136+
NeedsNonCascadingBuild,
150137
NewlyAdded
151138
};
152139

153140
public:
154-
Status status = Status::UpToDate;
141+
Status status = UpToDate;
155142
llvm::sys::TimePoint<> previousModTime;
156143

157144
InputInfo() = default;
158145
InputInfo(Status stat, llvm::sys::TimePoint<> time)
159146
: status(stat), previousModTime(time) {}
160147

161148
static InputInfo makeNewlyAdded() {
162-
return {Status::NewlyAdded, llvm::sys::TimePoint<>::max()};
163-
}
164-
165-
static InputInfo makeNeedsCascadingRebuild() {
166-
return {Status::NeedsCascadingBuild, llvm::sys::TimePoint<>::min()};
149+
return InputInfo(Status::NewlyAdded, llvm::sys::TimePoint<>::max());
167150
}
168151
};
169152

@@ -183,8 +166,7 @@ class IncrementalJobAction : public JobAction {
183166

184167
public:
185168
static bool classof(const Action *A) {
186-
return A->getKind() == Action::Kind::CompileJob ||
187-
A->getKind() == Action::Kind::MergeModuleJob;
169+
return A->getKind() == Action::Kind::CompileJob;
188170
}
189171
};
190172

@@ -281,12 +263,12 @@ class REPLJobAction : public JobAction {
281263
}
282264
};
283265

284-
class MergeModuleJobAction : public IncrementalJobAction {
266+
class MergeModuleJobAction : public JobAction {
285267
virtual void anchor() override;
286268
public:
287-
MergeModuleJobAction(ArrayRef<const Action *> Inputs, InputInfo input)
288-
: IncrementalJobAction(Action::Kind::MergeModuleJob, Inputs,
289-
file_types::TY_SwiftModuleFile, input) {}
269+
MergeModuleJobAction(ArrayRef<const Action *> Inputs)
270+
: JobAction(Action::Kind::MergeModuleJob, Inputs,
271+
file_types::TY_SwiftModuleFile) {}
290272

291273
static bool classof(const Action *A) {
292274
return A->getKind() == Action::Kind::MergeModuleJob;

lib/Driver/Compilation.cpp

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ namespace driver {
446446

447447
std::vector<const Job*>
448448
reloadAndRemarkDeps(const Job *FinishedCmd, int ReturnCode,
449-
const bool forRanges) {
449+
const bool forRanges) {
450450
const CommandOutput &Output = FinishedCmd->getOutput();
451451
StringRef DependenciesFile =
452452
Output.getAdditionalOutputForType(file_types::TY_SwiftDeps);
@@ -458,8 +458,7 @@ namespace driver {
458458
// coarse dependencies that always affect downstream nodes), but we're
459459
// not using either of those right now, and this logic should probably
460460
// be revisited when we are.
461-
assert(isa<MergeModuleJobAction>(FinishedCmd->getSource()) ||
462-
FinishedCmd->getCondition() == Job::Condition::Always);
461+
assert(FinishedCmd->getCondition() == Job::Condition::Always);
463462
return {};
464463
}
465464
const bool compileExitedNormally =
@@ -908,7 +907,6 @@ namespace driver {
908907
return everyIncrementalJob;
909908
};
910909

911-
const Job *mergeModulesJob = nullptr;
912910
CommandSet jobsToSchedule;
913911
CommandSet initialCascadingCommands;
914912
for (const Job *cmd : Comp.getJobs()) {
@@ -917,11 +915,6 @@ namespace driver {
917915
continue;
918916
}
919917

920-
if (isa<MergeModuleJobAction>(cmd->getSource())) {
921-
assert(!mergeModulesJob && "multiple scheduled merge-modules jobs?");
922-
mergeModulesJob = cmd;
923-
}
924-
925918
const Optional<std::pair<bool, bool>> shouldSchedAndIsCascading =
926919
computeShouldInitiallyScheduleJobAndDependendents(cmd, forRanges);
927920
if (!shouldSchedAndIsCascading)
@@ -943,15 +936,6 @@ namespace driver {
943936
collectIncrementalExternallyDependentJobsFromDependencyGraph(
944937
forRanges))
945938
jobsToSchedule.insert(cmd);
946-
947-
// The merge-modules job is special: it *must* be scheduled if any other
948-
// job has been scheduled because any other job can influence the
949-
// structure of the resulting module. Additionally, the initial scheduling
950-
// predicate above is only aware of intra-module changes. External
951-
// dependencies changing *must* cause merge-modules to be scheduled.
952-
if (!jobsToSchedule.empty() && mergeModulesJob) {
953-
jobsToSchedule.insert(mergeModulesJob);
954-
}
955939
return jobsToSchedule;
956940
}
957941

@@ -1047,13 +1031,6 @@ namespace driver {
10471031
/// But returns None if there was a dependency read error.
10481032
Optional<std::pair<Job::Condition, bool>>
10491033
loadDependenciesAndComputeCondition(const Job *const Cmd, bool forRanges) {
1050-
// merge-modules Jobs do not have .swiftdeps files associated with them,
1051-
// however, their compilation condition is computed as a function of their
1052-
// inputs, so their condition can be used as normal.
1053-
if (isa<MergeModuleJobAction>(Cmd->getSource())) {
1054-
return std::make_pair(Cmd->getCondition(), true);
1055-
}
1056-
10571034
// Try to load the dependencies file for this job. If there isn't one, we
10581035
// always have to run the job, but it doesn't affect any other jobs. If
10591036
// there should be one but it's not present or can't be loaded, we have to
@@ -1186,12 +1163,7 @@ namespace driver {
11861163
continue;
11871164
}
11881165

1189-
// Is this module out of date? If not, just keep searching.
1190-
if (Comp.getLastBuildTime() >= depStatus.getLastModificationTime())
1191-
continue;
1192-
1193-
// Can we run a cross-module incremental build at all?
1194-
// If not, fall back.
1166+
// Can we run a cross-module incremental build at all? If not, fallback.
11951167
if (!Comp.getEnableCrossModuleIncrementalBuild()) {
11961168
fallbackToExternalBehavior(external);
11971169
continue;
@@ -1637,8 +1609,8 @@ namespace driver {
16371609
CompileJobAction::InputInfo info;
16381610
info.previousModTime = entry.first->getInputModTime();
16391611
info.status = entry.second ?
1640-
CompileJobAction::InputInfo::Status::NeedsCascadingBuild :
1641-
CompileJobAction::InputInfo::Status::NeedsNonCascadingBuild;
1612+
CompileJobAction::InputInfo::NeedsCascadingBuild :
1613+
CompileJobAction::InputInfo::NeedsNonCascadingBuild;
16421614
inputs[&inputFile->getInputArg()] = info;
16431615
}
16441616
}
@@ -1655,7 +1627,7 @@ namespace driver {
16551627

16561628
CompileJobAction::InputInfo info;
16571629
info.previousModTime = entry->getInputModTime();
1658-
info.status = CompileJobAction::InputInfo::Status::UpToDate;
1630+
info.status = CompileJobAction::InputInfo::UpToDate;
16591631
inputs[&inputFile->getInputArg()] = info;
16601632
}
16611633
}

lib/Driver/CompilationRecord.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ inline static StringRef getName(TopLevelKey Key) {
5959
inline static StringRef
6060
getIdentifierForInputInfoStatus(CompileJobAction::InputInfo::Status Status) {
6161
switch (Status) {
62-
case CompileJobAction::InputInfo::Status::UpToDate:
62+
case CompileJobAction::InputInfo::UpToDate:
6363
return "";
64-
case CompileJobAction::InputInfo::Status::NewlyAdded:
65-
case CompileJobAction::InputInfo::Status::NeedsCascadingBuild:
64+
case CompileJobAction::InputInfo::NewlyAdded:
65+
case CompileJobAction::InputInfo::NeedsCascadingBuild:
6666
return "!dirty";
67-
case CompileJobAction::InputInfo::Status::NeedsNonCascadingBuild:
67+
case CompileJobAction::InputInfo::NeedsNonCascadingBuild:
6868
return "!private";
6969
}
7070

@@ -76,11 +76,11 @@ getIdentifierForInputInfoStatus(CompileJobAction::InputInfo::Status Status) {
7676
/// compilation record file (.swiftdeps file).
7777
inline static Optional<CompileJobAction::InputInfo::Status>
7878
getInfoStatusForIdentifier(StringRef Identifier) {
79-
using InputStatus = CompileJobAction::InputInfo::Status;
80-
return llvm::StringSwitch<Optional<InputStatus>>(Identifier)
81-
.Case("", InputStatus::UpToDate)
82-
.Case("!dirty", InputStatus::NeedsCascadingBuild)
83-
.Case("!private", InputStatus::NeedsNonCascadingBuild)
79+
return llvm::StringSwitch<Optional<
80+
CompileJobAction::InputInfo::Status>>(Identifier)
81+
.Case("", CompileJobAction::InputInfo::UpToDate)
82+
.Case("!dirty", CompileJobAction::InputInfo::NeedsCascadingBuild)
83+
.Case("!private", CompileJobAction::InputInfo::NeedsNonCascadingBuild)
8484
.Default(None);
8585
}
8686

0 commit comments

Comments
 (0)