https://github.com/tblah created https://github.com/llvm/llvm-project/pull/144915
RFC: https://discourse.llvm.org/t/rfc-removing-the-openmp-experimental-warning-for-llvm-21/86455 Fixes: #110008 There are a handful of open issues still to resolve before this can go out of draft. See the linked issue. >From e41a93accace06b39e8421fddbfd7673a3b429dc Mon Sep 17 00:00:00 2001 From: Tom Eccles <tom.ecc...@arm.com> Date: Thu, 19 Jun 2025 14:57:04 +0000 Subject: [PATCH] DRAFT: [flang][OpenMP] Remove experimental warning RFC: https://discourse.llvm.org/t/rfc-removing-the-openmp-experimental-warning-for-llvm-21/86455 Fixes: #110008 --- .../clang/Basic/DiagnosticDriverKinds.td | 4 ++-- clang/lib/Driver/ToolChains/Flang.cpp | 19 ++++++++++++++++--- flang/test/Driver/fopenmp.f90 | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 29f6480ba935c..68f87ebb1b39f 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -143,8 +143,8 @@ def warn_drv_unsupported_option_for_processor : Warning< def warn_drv_unsupported_openmp_library : Warning< "the library '%0=%1' is not supported, OpenMP will not be enabled">, InGroup<OptionIgnored>; -def warn_openmp_experimental : Warning< - "OpenMP support in flang is still experimental">, +def warn_openmp_incomplete : Warning< + "OpenMP support for version %0 in flang is still incomplete">, InGroup<ExperimentalOption>; def err_drv_invalid_thread_model_for_target : Error< diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index 47d0e345086b2..04613457cb20a 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -11,6 +11,7 @@ #include "clang/Basic/CodeGenOptions.h" #include "clang/Driver/CommonArgs.h" +#include "clang/Driver/OptionUtils.h" #include "clang/Driver/Options.h" #include "llvm/Frontend/Debug/Options.h" #include "llvm/Support/Path.h" @@ -772,6 +773,13 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs, } } +static std::string OpenMPVersionToString(int Version) { + int Major = Version / 10; + int Minor = Version % 10; + + return llvm::Twine{Major}.concat(".").concat(llvm::Twine{Minor}).str(); +} + void Flang::ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { @@ -906,9 +914,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_fopenmp_force_usm)) CmdArgs.push_back("-fopenmp-force-usm"); - // TODO: OpenMP support isn't "done" yet, so for now we warn that it - // is experimental. - D.Diag(diag::warn_openmp_experimental); + + // TODO: OpenMP support for newer versions of the standard is incomplete. + if (int Version = + getLastArgIntValue(Args, options::OPT_fopenmp_version_EQ, 0)) { + if (Version >= 40) + D.Diag(diag::warn_openmp_incomplete) + << OpenMPVersionToString(Version); + } // FIXME: Clang supports a whole bunch more flags here. break; diff --git a/flang/test/Driver/fopenmp.f90 b/flang/test/Driver/fopenmp.f90 index b3c3547800bdb..b170e77372d50 100644 --- a/flang/test/Driver/fopenmp.f90 +++ b/flang/test/Driver/fopenmp.f90 @@ -74,6 +74,6 @@ ! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}" ! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}" ! -! RUN: %flang -fopenmp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL +! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL ! -! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support in flang is still experimental +! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support for version 4.0 in flang is still incomplete _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits