@@ -2242,6 +2242,22 @@ void parseExclusivityEnforcementOptions(const llvm::opt::Arg *A,
2242
2242
}
2243
2243
}
2244
2244
2245
+ static std::optional<IRGenLLVMLTOKind>
2246
+ ParseLLVMLTOKind (const ArgList &Args, DiagnosticEngine &Diags) {
2247
+ std::optional<IRGenLLVMLTOKind> LLVMLTOKind;
2248
+ if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
2249
+ LLVMLTOKind =
2250
+ llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
2251
+ .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
2252
+ .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
2253
+ .Default (std::nullopt);
2254
+ if (!LLVMLTOKind)
2255
+ Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
2256
+ A->getAsString (Args), A->getValue ());
2257
+ }
2258
+ return LLVMLTOKind;
2259
+ }
2260
+
2245
2261
static bool ParseSILArgs (SILOptions &Opts, ArgList &Args,
2246
2262
IRGenOptions &IRGenOpts, const FrontendOptions &FEOpts,
2247
2263
const TypeCheckerOptions &TCOpts,
@@ -2629,6 +2645,16 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2629
2645
2630
2646
Opts.NoAllocations = Args.hasArg (OPT_no_allocations);
2631
2647
2648
+ // If these optimizations are enabled never preserve functions for the
2649
+ // debugger.
2650
+ Opts.ShouldFunctionsBePreservedToDebugger =
2651
+ !Args.hasArg (OPT_enable_llvm_wme);
2652
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2653
+ !Args.hasArg (OPT_enable_llvm_vfe);
2654
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
2655
+ Opts.ShouldFunctionsBePreservedToDebugger &=
2656
+ LTOKind.value () == IRGenLLVMLTOKind::None;
2657
+
2632
2658
return false ;
2633
2659
}
2634
2660
@@ -2975,18 +3001,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
2975
3001
}
2976
3002
}
2977
3003
2978
- if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
2979
- auto LLVMLTOKind =
2980
- llvm::StringSwitch<std::optional<IRGenLLVMLTOKind>>(A->getValue ())
2981
- .Case (" llvm-thin" , IRGenLLVMLTOKind::Thin)
2982
- .Case (" llvm-full" , IRGenLLVMLTOKind::Full)
2983
- .Default (std::nullopt);
2984
- if (LLVMLTOKind)
2985
- Opts.LLVMLTOKind = LLVMLTOKind.value ();
2986
- else
2987
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
2988
- A->getAsString (Args), A->getValue ());
2989
- }
3004
+ if (auto LTOKind = ParseLLVMLTOKind (Args, Diags))
3005
+ Opts.LLVMLTOKind = LTOKind.value ();
2990
3006
2991
3007
if (const Arg *A = Args.getLastArg (options::OPT_sanitize_coverage_EQ)) {
2992
3008
Opts.SanitizeCoverage =
0 commit comments