Skip to content

Commit 89d31be

Browse files
author
Raj Barik
committed
ExistentialSpecializer Pass (without SILCombine/ConcreteType Propagation)
1 parent a37c1f0 commit 89d31be

File tree

10 files changed

+1382
-0
lines changed

10 files changed

+1382
-0
lines changed

include/swift/AST/SILOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class SILOptions {
5050
/// Remove all runtime assertions during optimizations.
5151
bool RemoveRuntimeAsserts = false;
5252

53+
/// Enable existential specializer optimization.
54+
bool ExistentialSpecializer = false;
55+
5356
/// Controls whether the SIL ARC optimizations are run.
5457
bool EnableARCOptimizations = true;
5558

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ def sil_unroll_threshold : Separate<["-"], "sil-unroll-threshold">,
424424
MetaVarName<"<250>">,
425425
HelpText<"Controls the aggressiveness of loop unrolling">;
426426

427+
def sil_existential_specializer : Flag<["-"], "sil-existential-specializer">,
428+
HelpText<"Enable SIL existential specializer optimization">;
429+
427430
def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
428431
HelpText<"Merge SIL from all partial swiftmodules into the final module">;
429432

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ PASS(DeadStoreElimination, "dead-store-elim",
160160
"Dead Store Elimination")
161161
PASS(GenericSpecializer, "generic-specializer",
162162
"Generic Function Specialization on Static Types")
163+
PASS(ExistentialSpecializer, "existential-specializer",
164+
"Existential Specializer")
163165
PASS(GlobalOpt, "global-opt",
164166
"SIL Global Optimization")
165167
PASS(GlobalPropertyOpt, "global-property-opt",

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
608608
return true;
609609
}
610610
}
611+
if (Args.hasArg(OPT_sil_existential_specializer)) {
612+
Opts.ExistentialSpecializer = true;
613+
}
611614
if (const Arg *A = Args.getLastArg(OPT_num_threads)) {
612615
if (StringRef(A->getValue()).getAsInteger(10, Opts.NumThreads)) {
613616
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,

lib/SILOptimizer/FunctionSignatureTransforms/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ silopt_register_sources(
33
DeadArgumentTransform.cpp
44
ArgumentExplosionTransform.cpp
55
OwnedToGuaranteedTransform.cpp
6+
ExistentialSpecializer.cpp
7+
ExistentialTransform.cpp
68
)

0 commit comments

Comments
 (0)