Base LexicalLifetimes dflt on SILOpts::CopyProp.

Previously, the default value for SILOptions::LexicalLifetimes was based
on a copy propagation behavior (which can then be overridden by the
flags for lexical lifetimems) only when the copy propagation was
explicitly specified.  Instead, set base the default value for this
option (SILOptions::LexicalLifetimes) on the effective copy propagation
behavior (i.e. SILOptions::CopyPropagation) regardless of whether an
explicit behavior has been specified.

Doing so will ensure that the desired behavior occurs as the default
behavior for copy-propagation changes, but for now this change is NFC.
This commit is contained in:
Nate Chandler
2021-12-14 08:56:48 -08:00
parent 5db2bf5df3
commit e881e2accd
2 changed files with 13 additions and 7 deletions

View File

@@ -1522,13 +1522,14 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
return true;
}
// -enable-copy-propagation implies -enable-lexical-lifetimes unless
// otherwise specified.
if (Args.hasArg(OPT_enable_copy_propagation))
// Unless overridden below, enabling copy propagation means enabling lexical
// lifetimes.
if (Opts.CopyPropagation == CopyPropagationOption::On)
Opts.LexicalLifetimes = LexicalLifetimesOption::On;
// -disable-copy-propagation implies -enable-lexical-lifetimes=false
if (Args.hasArg(OPT_disable_copy_propagation))
// Unless overridden below, disable copy propagation means disabling lexical
// lifetimes.
if (Opts.CopyPropagation == CopyPropagationOption::Off)
Opts.LexicalLifetimes = LexicalLifetimesOption::DiagnosticMarkersOnly;
// If move-only is enabled, always enable lexical lifetime as well. Move-only