Skip to content

Commit 611102b

Browse files
authored
Merge pull request #84846 from eeckstein/remove-speculative-devirtualization
Optimizer: remove the obsolete SpeculativeDevirtualization pass
2 parents 5e77606 + 65e4c10 commit 611102b

28 files changed

+32
-1773
lines changed

include/swift/AST/SILOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ class SILOptions {
108108
/// purposes.
109109
bool EnableOSSAOptimizations = true;
110110

111-
/// Controls whether to turn on speculative devirtualization.
112-
/// It is turned off by default.
113-
bool EnableSpeculativeDevirtualization = false;
114-
115111
/// Controls whether to emit actor data-race checks.
116112
bool EnableActorDataRaceChecks = false;
117113

include/swift/Option/FrontendOptions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def disable_sil_partial_apply : Flag<["-"], "disable-sil-partial-apply">,
578578
HelpText<"Disable use of partial_apply in SIL generation">;
579579

580580
def enable_spec_devirt : Flag<["-"], "enable-spec-devirt">,
581-
HelpText<"Enable speculative devirtualization pass.">;
581+
HelpText<"Deprecated, has no effect">;
582582

583583
def enable_async_demotion : Flag<["-"], "enable-experimental-async-demotion">,
584584
HelpText<"Enables an optimization pass to demote async functions.">;

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ LEGACY_PASS(SimplifyBBArgs, "simplify-bb-args",
428428
"SIL Block Argument Simplification")
429429
LEGACY_PASS(SimplifyCFG, "simplify-cfg",
430430
"SIL CFG Simplification")
431-
LEGACY_PASS(SpeculativeDevirtualization, "specdevirt",
432-
"Speculative Devirtualization via Guarded Calls")
433431
LEGACY_PASS(SplitAllCriticalEdges, "split-critical-edges",
434432
"Split all Critical Edges in the SIL CFG")
435433
LEGACY_PASS(SplitNonCondBrCriticalEdges, "split-non-cond_br-critical-edges",

lib/DriverTool/sil_opt_main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ struct SILOptOptions {
296296
VerifyExclusivity = llvm::cl::opt<bool>("enable-verify-exclusivity",
297297
llvm::cl::desc("Verify the access markers used to enforce exclusivity."));
298298

299-
llvm::cl::opt<bool>
300-
EnableSpeculativeDevirtualization = llvm::cl::opt<bool>("enable-spec-devirt",
301-
llvm::cl::desc("Enable Speculative Devirtualization pass."));
302-
303299
llvm::cl::opt<bool>
304300
EnableAsyncDemotion = llvm::cl::opt<bool>("enable-async-demotion",
305301
llvm::cl::desc("Enables an optimization pass to demote async functions."));
@@ -891,7 +887,6 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
891887
SILOpts.EmitVerboseSIL |= options.EmitVerboseSIL;
892888
SILOpts.EmitSortedSIL |= options.EmitSortedSIL;
893889

894-
SILOpts.EnableSpeculativeDevirtualization = options.EnableSpeculativeDevirtualization;
895890
SILOpts.EnableAsyncDemotion = options.EnableAsyncDemotion;
896891
SILOpts.EnableThrowsPrediction = options.EnableThrowsPrediction;
897892
SILOpts.EnableNoReturnCold = options.EnableNoReturnCold;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3081,7 +3081,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
30813081
Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts);
30823082
Opts.EnableSILOpaqueValues = Args.hasFlag(
30833083
OPT_enable_sil_opaque_values, OPT_disable_sil_opaque_values, false);
3084-
Opts.EnableSpeculativeDevirtualization |= Args.hasArg(OPT_enable_spec_devirt);
30853084
Opts.EnableAsyncDemotion |= Args.hasArg(OPT_enable_async_demotion);
30863085
Opts.EnableThrowsPrediction = Args.hasFlag(
30873086
OPT_enable_throws_prediction, OPT_disable_throws_prediction,

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,6 @@ static void addClosureSpecializePassPipeline(SILPassPipelinePlan &P) {
795795
// Do the second stack promotion on low-level SIL.
796796
P.addStackPromotion();
797797

798-
// Speculate virtual call targets.
799-
if (P.getOptions().EnableSpeculativeDevirtualization) {
800-
P.addSpeculativeDevirtualization();
801-
}
802-
803798
// There should be at least one SILCombine+SimplifyCFG between the
804799
// ClosureSpecializer, etc. and the last inliner. Cleaning up after these
805800
// passes can expose more inlining opportunities.

lib/SILOptimizer/Transforms/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ target_sources(swiftSILOptimizer PRIVATE
3131
DestroyAddrHoisting.cpp
3232
SimplifyCFG.cpp
3333
Sink.cpp
34-
SpeculativeDevirtualizer.cpp
3534
StringOptimization.cpp)
3635

0 commit comments

Comments
 (0)