[flang-commits] [clang] [flang] [flang][OpenMP] Upstream first part of `do concurrent` mapping (PR #126026)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu Feb 13 04:23:09 PST 2025
================
@@ -352,16 +352,38 @@ bool CodeGenAction::beginSourceFileAction() {
// Add OpenMP-related passes
// WARNING: These passes must be run immediately after the lowering to ensure
// that the FIR is correct with respect to OpenMP operations/attributes.
- if (ci.getInvocation().getFrontendOpts().features.IsEnabled(
- Fortran::common::LanguageFeature::OpenMP)) {
- bool isDevice = false;
+ bool isOpenMPEnabled =
+ ci.getInvocation().getFrontendOpts().features.IsEnabled(
+ Fortran::common::LanguageFeature::OpenMP);
+
+ fir::OpenMPFIRPassPipelineOpts opts;
+
+ using DoConcurrentMappingKind =
+ Fortran::frontend::CodeGenOptions::DoConcurrentMappingKind;
+ opts.doConcurrentMappingKind =
+ ci.getInvocation().getCodeGenOpts().getDoConcurrentMapping();
+
+ if (opts.doConcurrentMappingKind != DoConcurrentMappingKind::DCMK_None &&
+ !isOpenMPEnabled) {
+ unsigned diagID = ci.getDiagnostics().getCustomDiagID(
+ clang::DiagnosticsEngine::Warning,
+ "lowering `do concurrent` loops to OpenMP is only supported if "
+ "OpenMP is enabled. Enable OpenMP using `-fopenmp`. `do concurrent` "
+ "loops will be serialized.");
----------------
kiranchandramohan wrote:
Nit: It will be great if the warning can be in a single line or in lines separated by full stops. This will aid better searching for this warning.
https://github.com/llvm/llvm-project/pull/126026
More information about the flang-commits
mailing list