@@ -2203,6 +2203,22 @@ void parseExclusivityEnforcementOptions(const llvm::opt::Arg *A,
2203
2203
}
2204
2204
}
2205
2205
2206
+ static std::optional<IRGenLLVMLTOKind>
2207
+ ParseLLVMLTOKind (const ArgList &Args, DiagnosticEngine &Diags) {
2208
+ std::optional<IRGenLLVMLTOKind> LLVMLTOKind;
2209
+ if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
2210
+ LLVMLTOKind =
2211
+ llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
2212
+ .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
2213
+ .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
2214
+ .Default (std::nullopt);
2215
+ if (!LLVMLTOKind)
2216
+ Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
2217
+ A->getAsString (Args), A->getValue ());
2218
+ }
2219
+ return LLVMLTOKind;
2220
+ }
2221
+
2206
2222
static bool ParseSILArgs (SILOptions &Opts, ArgList &Args,
2207
2223
IRGenOptions &IRGenOpts, const FrontendOptions &FEOpts,
2208
2224
const TypeCheckerOptions &TCOpts,
@@ -2603,6 +2619,16 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2603
2619
Opts.EnableExperimentalSwiftBasedClosureSpecialization =
2604
2620
Args.hasArg (OPT_enable_experimental_swift_based_closure_specialization);
2605
2621
2622
+ // If these optimizations are enabled never preserve functions for the
2623
+ // debugger.
2624
+ Opts.ShouldFunctionsBePreservedToDebugger =
2625
+ !Args.hasArg (OPT_enable_llvm_wme);
2626
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2627
+ !Args.hasArg (OPT_enable_llvm_vfe);
2628
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
2629
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2630
+ LTOKind.value () == IRGenLLVMLTOKind::None;
2631
+
2606
2632
return false ;
2607
2633
}
2608
2634
@@ -2949,18 +2975,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
2949
2975
}
2950
2976
}
2951
2977
2952
- if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
2953
- auto LLVMLTOKind =
2954
- llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
2955
- .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
2956
- .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
2957
- .Default (std::nullopt);
2958
- if (LLVMLTOKind)
2959
- Opts.LLVMLTOKind = LLVMLTOKind.value ();
2960
- else
2961
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
2962
- A->getAsString (Args), A->getValue ());
2963
- }
2978
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
2979
+ Opts.LLVMLTOKind = LTOKind.value ();
2964
2980
2965
2981
if (const Arg *A = Args.getLastArg (options::OPT_sanitize_coverage_EQ)) {
2966
2982
Opts.SanitizeCoverage =
0 commit comments