mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SILOpt] Added flag to disable destroy hoisting.
It is on by default. The default changes with the value of the CopyPropagation setting. But it can still be overridden.
This commit is contained in:
@@ -1553,6 +1553,15 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
// -Ounchecked might also set removal of runtime asserts (cond_fail).
|
||||
Opts.RemoveRuntimeAsserts |= Args.hasArg(OPT_RemoveRuntimeAsserts);
|
||||
|
||||
Optional<DestroyHoistingOption> specifiedDestroyHoistingOption;
|
||||
if (Arg *A = Args.getLastArg(OPT_enable_destroy_hoisting)) {
|
||||
specifiedDestroyHoistingOption =
|
||||
llvm::StringSwitch<Optional<DestroyHoistingOption>>(A->getValue())
|
||||
.Case("true", DestroyHoistingOption::On)
|
||||
.Case("false", DestroyHoistingOption::Off)
|
||||
.Default(None);
|
||||
}
|
||||
|
||||
Optional<CopyPropagationOption> specifiedCopyPropagationOption;
|
||||
if (Arg *A = Args.getLastArg(OPT_copy_propagation_state_EQ)) {
|
||||
specifiedCopyPropagationOption =
|
||||
@@ -1654,13 +1663,17 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
|
||||
// Unless overridden below, enabling copy propagation means enabling lexical
|
||||
// lifetimes.
|
||||
if (Opts.CopyPropagation == CopyPropagationOption::On)
|
||||
if (Opts.CopyPropagation == CopyPropagationOption::On) {
|
||||
Opts.LexicalLifetimes = LexicalLifetimesOption::On;
|
||||
Opts.DestroyHoisting = DestroyHoistingOption::On;
|
||||
}
|
||||
|
||||
// Unless overridden below, disable copy propagation means disabling lexical
|
||||
// lifetimes.
|
||||
if (Opts.CopyPropagation == CopyPropagationOption::Off)
|
||||
if (Opts.CopyPropagation == CopyPropagationOption::Off) {
|
||||
Opts.LexicalLifetimes = LexicalLifetimesOption::DiagnosticMarkersOnly;
|
||||
Opts.DestroyHoisting = DestroyHoistingOption::Off;
|
||||
}
|
||||
|
||||
// If move-only is enabled, always enable lexical lifetime as well. Move-only
|
||||
// depends on lexical lifetimes.
|
||||
@@ -1681,6 +1694,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
Opts.LexicalLifetimes = LexicalLifetimesOption::Off;
|
||||
}
|
||||
}
|
||||
if (specifiedDestroyHoistingOption)
|
||||
Opts.DestroyHoisting = *specifiedDestroyHoistingOption;
|
||||
|
||||
Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts);
|
||||
Opts.EnableOSSAModules |= Args.hasArg(OPT_enable_ossa_modules);
|
||||
|
||||
Reference in New Issue
Block a user