@@ -2278,6 +2278,22 @@ void parseExclusivityEnforcementOptions(const llvm::opt::Arg *A,
2278
2278
}
2279
2279
}
2280
2280
2281
+ static std::optional<IRGenLLVMLTOKind>
2282
+ ParseLLVMLTOKind (const ArgList &Args, DiagnosticEngine &Diags) {
2283
+ std::optional<IRGenLLVMLTOKind> LLVMLTOKind;
2284
+ if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
2285
+ LLVMLTOKind =
2286
+ llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
2287
+ .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
2288
+ .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
2289
+ .Default (std::nullopt);
2290
+ if (!LLVMLTOKind)
2291
+ Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
2292
+ A->getAsString (Args), A->getValue ());
2293
+ }
2294
+ return LLVMLTOKind;
2295
+ }
2296
+
2281
2297
static bool ParseSILArgs (SILOptions &Opts, ArgList &Args,
2282
2298
IRGenOptions &IRGenOpts, const FrontendOptions &FEOpts,
2283
2299
const TypeCheckerOptions &TCOpts,
@@ -2678,6 +2694,16 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2678
2694
Opts.EnableExperimentalSwiftBasedClosureSpecialization =
2679
2695
Args.hasArg (OPT_enable_experimental_swift_based_closure_specialization);
2680
2696
2697
+ // If these optimizations are enabled never preserve functions for the
2698
+ // debugger.
2699
+ Opts.ShouldFunctionsBePreservedToDebugger =
2700
+ !Args.hasArg (OPT_enable_llvm_wme);
2701
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2702
+ !Args.hasArg (OPT_enable_llvm_vfe);
2703
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
2704
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2705
+ LTOKind.value () == IRGenLLVMLTOKind::None;
2706
+
2681
2707
return false ;
2682
2708
}
2683
2709
@@ -3024,18 +3050,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
3024
3050
}
3025
3051
}
3026
3052
3027
- if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
3028
- auto LLVMLTOKind =
3029
- llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
3030
- .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
3031
- .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
3032
- .Default (std::nullopt);
3033
- if (LLVMLTOKind)
3034
- Opts.LLVMLTOKind = LLVMLTOKind.value ();
3035
- else
3036
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
3037
- A->getAsString (Args), A->getValue ());
3038
- }
3053
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
3054
+ Opts.LLVMLTOKind = LTOKind.value ();
3039
3055
3040
3056
if (const Arg *A = Args.getLastArg (options::OPT_sanitize_coverage_EQ)) {
3041
3057
Opts.SanitizeCoverage =
0 commit comments