File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,10 @@ class SILOptions {
318
318
// / for the debugger?
319
319
bool ShouldFunctionsBePreservedToDebugger = true ;
320
320
321
+ // / Block expanding and register promotion more aggressively throughout the
322
+ // / optimizer.
323
+ bool UseAggressiveReg2MemForCodeSize = false ;
324
+
321
325
SILOptions () {}
322
326
323
327
// / Return a hash code of any components from these options that should
Original file line number Diff line number Diff line change @@ -1294,6 +1294,13 @@ def disable_lifetime_dependence_diagnostics :
1294
1294
Flag<["-"], "disable-lifetime-dependence-diagnostics">,
1295
1295
HelpText<"Disable lifetime dependence diagnostics for Nonescapable types.">;
1296
1296
1297
+ def enable_aggressive_reg2mem :
1298
+ Flag<["-"], "enable-aggressive-reg2mem">,
1299
+ HelpText<"Enable a more aggresive reg2mem heuristic">;
1300
+ def disable_aggressive_reg2mem :
1301
+ Flag<["-"], "disable-aggresive-reg2mem">,
1302
+ HelpText<"Disable a more aggresive reg2mem heuristic">;
1303
+
1297
1304
def enable_collocate_metadata_functions :
1298
1305
Flag<["-"], "enable-collocate-metadata-functions">,
1299
1306
HelpText<"Enable collocate metadata functions">;
Original file line number Diff line number Diff line change @@ -3738,6 +3738,7 @@ bool CompilerInvocation::parseArgs(
3738
3738
SILOpts.SkipFunctionBodies = FunctionBodySkipping::None;
3739
3739
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
3740
3740
SILOpts.EmbeddedSwift = true ;
3741
+ SILOpts.UseAggressiveReg2MemForCodeSize = true ;
3741
3742
// OSSA modules are required for deinit de-virtualization.
3742
3743
SILOpts.EnableOSSAModules = true ;
3743
3744
// -g is promoted to -gdwarf-types in embedded Swift
@@ -3751,6 +3752,11 @@ bool CompilerInvocation::parseArgs(
3751
3752
}
3752
3753
}
3753
3754
3755
+ SILOpts.UseAggressiveReg2MemForCodeSize =
3756
+ ParsedArgs.hasFlag (OPT_enable_aggressive_reg2mem,
3757
+ OPT_disable_aggressive_reg2mem,
3758
+ SILOpts.UseAggressiveReg2MemForCodeSize );
3759
+
3754
3760
// With Swift 6, enable @_spiOnly by default. This also enables proper error
3755
3761
// reporting of ioi references from spi decls.
3756
3762
if (LangOpts.EffectiveLanguageVersion .isVersionAtLeast (6 )) {
You can’t perform that action at this time.
0 commit comments