Skip to content

Commit 70781b2

Browse files
committed
[embedded] Avoid DropAllSILPass, reuse StopOptimizationAfterSerialization instead
1 parent 4623177 commit 70781b2

File tree

9 files changed

+8
-81
lines changed

9 files changed

+8
-81
lines changed

include/swift/AST/SILOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@ class SILOptions {
170170
/// Whether to stop the optimization pipeline after serializing SIL.
171171
bool StopOptimizationAfterSerialization = false;
172172

173-
/// Whether to drop all SIL after serializing SIL and continue compilation
174-
/// with an empty SIL module.
175-
bool DropAllSILAfterSerialization = false;
176-
177173
/// Whether to stop the optimization pipeline right before we lower ownership
178174
/// and go from OSSA to non-ownership SIL.
179175
bool StopOptimizationBeforeLoweringOwnership = false;

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,6 @@ PASS(SimplifyUnreachableContainingBlocks, "simplify-unreachable-containing-block
452452
"Utility pass. Removes all non-term insts from blocks with unreachable terms")
453453
PASS(SerializeSILPass, "serialize-sil",
454454
"Utility pass. Serializes the current SILModule")
455-
PASS(DropAllSILPass, "drop-all-sil",
456-
"Utility pass. Drops all SIL from the SILModule")
457455
PASS(UnitTestRunner, "test-runner",
458456
"Utility pass. Parses arguments and runs code with them.")
459457
PASS(YieldOnceCheck, "yield-once-check",

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
21862186
Opts.StopOptimizationAfterSerialization = true;
21872187

21882188
if (Args.getLastArg(OPT_emit_empty_object_file)) {
2189-
Opts.DropAllSILAfterSerialization = true;
2189+
Opts.StopOptimizationAfterSerialization = true;
21902190
}
21912191

21922192
// Propagate the typechecker's understanding of

lib/IRGen/GenDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class PrettySynthesizedFileUnitEmission : public llvm::PrettyStackTraceEntry {
454454

455455
/// Emit all the top-level code in the source file.
456456
void IRGenModule::emitSourceFile(SourceFile &SF) {
457-
if (getSILModule().getOptions().DropAllSILAfterSerialization) {
457+
if (getSILModule().getOptions().StopOptimizationAfterSerialization) {
458458
// We're asked to emit an empty IR module
459459
return;
460460
}
@@ -1264,7 +1264,7 @@ static bool isLazilyEmittedFunction(SILFunction &f, SILModule &m) {
12641264

12651265
void IRGenerator::emitGlobalTopLevel(
12661266
const std::vector<std::string> &linkerDirectives) {
1267-
if (PrimaryIGM->getSILModule().getOptions().DropAllSILAfterSerialization) {
1267+
if (PrimaryIGM->getSILModule().getOptions().StopOptimizationAfterSerialization) {
12681268
// We're asked to emit an empty IR module
12691269
return;
12701270
}
@@ -2205,7 +2205,7 @@ void IRGenerator::emitObjCActorsNeedingSuperclassSwizzle() {
22052205
/// from other modules. This happens e.g. if a public class contains a (dead)
22062206
/// private method.
22072207
void IRGenModule::emitVTableStubs() {
2208-
if (getSILModule().getOptions().DropAllSILAfterSerialization) {
2208+
if (getSILModule().getOptions().StopOptimizationAfterSerialization) {
22092209
// We're asked to emit an empty IR module
22102210
return;
22112211
}

lib/IRGen/GenReflection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ llvm::ArrayRef<CanType> IRGenModule::getOrCreateSpecialStlibBuiltinTypes() {
16671667
}
16681668

16691669
void IRGenModule::emitBuiltinReflectionMetadata() {
1670-
if (getSILModule().getOptions().DropAllSILAfterSerialization) {
1670+
if (getSILModule().getOptions().StopOptimizationAfterSerialization) {
16711671
// We're asked to emit an empty IR module
16721672
return;
16731673
}

lib/IRGen/IRGenModule.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,8 @@ void IRGenModule::cleanupClangCodeGenMetadata() {
19121912
bool IRGenModule::finalize() {
19131913
const char *ModuleHashVarName = "llvm.swift_module_hash";
19141914
if (IRGen.Opts.OutputKind == IRGenOutputKind::ObjectFile &&
1915-
!Module.getGlobalVariable(ModuleHashVarName) && !getSILModule().getOptions().DropAllSILAfterSerialization) {
1915+
!Module.getGlobalVariable(ModuleHashVarName) &&
1916+
!getSILModule().getOptions().StopOptimizationAfterSerialization) {
19161917
// Create a global variable into which we will store the hash of the
19171918
// module (used for incremental compilation).
19181919
// We have to create the variable now (before we emit the global lists).
@@ -1969,7 +1970,7 @@ bool IRGenModule::finalize() {
19691970
if (F.hasDLLImportStorageClass())
19701971
F.setDSOLocal(false);
19711972

1972-
if (getSILModule().getOptions().DropAllSILAfterSerialization) {
1973+
if (getSILModule().getOptions().StopOptimizationAfterSerialization) {
19731974
// We're asked to emit an empty IR module, check that that's actually true
19741975
if (Module.global_size() != 0 || Module.size() != 0) {
19751976
Module.dump();

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -997,9 +997,6 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
997997
if (Options.StopOptimizationAfterSerialization)
998998
return P;
999999

1000-
if (Options.DropAllSILAfterSerialization)
1001-
P.addDropAllSILPass();
1002-
10031000
// After serialization run the function pass pipeline to iteratively lower
10041001
// high-level constructs like @_semantics calls.
10051002
addMidLevelFunctionPipeline(P);
@@ -1058,9 +1055,6 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
10581055
P.startPipeline("Serialization");
10591056
P.addSerializeSILPass();
10601057

1061-
if (Options.DropAllSILAfterSerialization)
1062-
P.addDropAllSILPass();
1063-
10641058
// Now that we have serialized, propagate debug info.
10651059
P.addMovedAsyncVarDebugInfoPropagator();
10661060

lib/SILOptimizer/UtilityPasses/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ target_sources(swiftSILOptimizer PRIVATE
1313
ComputeLoopInfo.cpp
1414
ConstantEvaluatorTester.cpp
1515
ConstantEvaluableSubsetChecker.cpp
16-
DropAllSILPass.cpp
1716
EpilogueARCMatcherDumper.cpp
1817
EpilogueRetainReleaseMatcherDumper.cpp
1918
FunctionOrderPrinter.cpp

lib/SILOptimizer/UtilityPasses/DropAllSILPass.cpp

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

0 commit comments

Comments
 (0)