From 8d2034cf68b51041a40069b0d868dfcdbf719685 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 27 Jun 2025 13:46:54 -0700 Subject: [clang] Add flag fallow-runtime-check-skip-hot-cutoff (#145999) Co-authored-by: Kazu Hirata --- clang/lib/Frontend/CompilerInvocation.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 9e269ab..f366e90 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1820,6 +1820,11 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const CodeGenOptions &Opts, for (std::string Sanitizer : Values) GenerateArg(Consumer, OPT_fsanitize_skip_hot_cutoff_EQ, Sanitizer); + if (Opts.AllowRuntimeCheckSkipHotCutoff) { + GenerateArg(Consumer, OPT_fallow_runtime_check_skip_hot_cutoff_EQ, + std::to_string(*Opts.AllowRuntimeCheckSkipHotCutoff)); + } + for (StringRef Sanitizer : serializeSanitizerKinds(Opts.SanitizeAnnotateDebugInfo)) GenerateArg(Consumer, OPT_fsanitize_annotate_debug_info_EQ, Sanitizer); @@ -2322,6 +2327,18 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Args.getAllArgValues(OPT_fsanitize_annotate_debug_info_EQ), Diags, Opts.SanitizeAnnotateDebugInfo); + if (StringRef V = + Args.getLastArgValue(OPT_fallow_runtime_check_skip_hot_cutoff_EQ); + !V.empty()) { + double A; + if (V.getAsDouble(A) || A < 0.0 || A > 1.0) { + Diags.Report(diag::err_drv_invalid_value) + << "-fallow-runtime-check-skip-hot-cutoff=" << V; + } else { + Opts.AllowRuntimeCheckSkipHotCutoff = A; + } + } + Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true); if (!LangOpts->CUDAIsDevice) -- cgit v1.1