Add a SILOption to control whether we should use an aggressive form of

keeping large values indirect
This commit is contained in:
Arnold Schwaighofer
2024-10-30 08:43:22 -07:00
parent 432c9d4549
commit 328b8695f3
3 changed files with 17 additions and 0 deletions

View File

@@ -3738,6 +3738,7 @@ bool CompilerInvocation::parseArgs(
SILOpts.SkipFunctionBodies = FunctionBodySkipping::None;
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
SILOpts.EmbeddedSwift = true;
SILOpts.UseAggressiveReg2MemForCodeSize = true;
// OSSA modules are required for deinit de-virtualization.
SILOpts.EnableOSSAModules = true;
// -g is promoted to -gdwarf-types in embedded Swift
@@ -3751,6 +3752,11 @@ bool CompilerInvocation::parseArgs(
}
}
SILOpts.UseAggressiveReg2MemForCodeSize =
ParsedArgs.hasFlag(OPT_enable_aggressive_reg2mem,
OPT_disable_aggressive_reg2mem,
SILOpts.UseAggressiveReg2MemForCodeSize);
// With Swift 6, enable @_spiOnly by default. This also enables proper error
// reporting of ioi references from spi decls.
if (LangOpts.EffectiveLanguageVersion.isVersionAtLeast(6)) {