[Frontend] Removed lexical-borrow-scope flag.

Adding `move_value [lexical]` and `begin_borrow [lexical]` should happen
all the time at this point.  Remove the ability to omit these
instructions and update the corresponding tests.
This commit is contained in:
Nate Chandler
2024-02-05 16:13:30 -08:00
parent 9f134ea0e3
commit ddccaa7d9c
19 changed files with 85 additions and 158 deletions

View File

@@ -2183,15 +2183,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.CopyPropagation = *specifiedCopyPropagationOption;
}
llvm::Optional<bool> enableLexicalBorrowScopesFlag;
if (Arg *A = Args.getLastArg(OPT_enable_lexical_borrow_scopes)) {
enableLexicalBorrowScopesFlag =
llvm::StringSwitch<llvm::Optional<bool>>(A->getValue())
.Case("true", true)
.Case("false", false)
.Default(llvm::None);
}
// Allow command line flags to override the default value of
// Opts.LexicalLifetimes. If no explicit flags are passed, then
// Opts.LexicalLifetimes retains its initial value.
@@ -2216,26 +2207,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
}
}
if (enableLexicalLifetimesFlag.value_or(false) &&
!enableLexicalBorrowScopesFlag.value_or(true)) {
// Error if lexical lifetimes have been enabled but lexical borrow scopes--
// on which they are dependent--have been disabled.
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
"enable-lexical-lifetimes=true",
"enable-lexical-borrow-scopes=false");
return true;
}
if (Args.hasArg(OPT_enable_experimental_move_only) &&
!enableLexicalBorrowScopesFlag.value_or(true)) {
// Error if move-only is enabled and lexical borrow scopes--on which it
// depends--has been disabled.
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
"enable-experimental-move-only",
"enable-lexical-borrow-scopes=false");
return true;
}
// Unless overridden below, enabling copy propagation means enabling lexical
// lifetimes.
if (Opts.CopyPropagation == CopyPropagationOption::On) {
@@ -2262,13 +2233,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.LexicalLifetimes = LexicalLifetimesOption::DiagnosticMarkersOnly;
}
}
if (enableLexicalBorrowScopesFlag) {
if (*enableLexicalBorrowScopesFlag) {
Opts.LexicalLifetimes = LexicalLifetimesOption::DiagnosticMarkersOnly;
} else {
Opts.LexicalLifetimes = LexicalLifetimesOption::Off;
}
}
if (specifiedDestroyHoistingOption)
Opts.DestroyHoisting = *specifiedDestroyHoistingOption;