[flang-commits] [flang] [flang][openacc] Only issue a warning when acc routine func is not found (PR #70964)

via flang-commits flang-commits at lists.llvm.org
Wed Nov 1 10:36:43 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-openacc

Author: Valentin Clement (バレンタイン クレメン) (clementval)

<details>
<summary>Changes</summary>

Do not issue a hard error when the function in acc routine directive is not present in the current translation unit. Only issue a warning. 

---
Full diff: https://github.com/llvm/llvm-project/pull/70964.diff


1 Files Affected:

- (modified) flang/lib/Lower/OpenACC.cpp (+6-3) 


``````````diff
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 8218af691b79c86..348ab93e425b131 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -3295,9 +3295,12 @@ void Fortran::lower::finalizeOpenACCRoutineAttachment(
     mlir::func::FuncOp funcOp =
         mod.lookupSymbol<mlir::func::FuncOp>(mapping.first);
     if (!funcOp)
-      llvm::report_fatal_error(
-          "could not find function to attach OpenACC routine information.");
-    attachRoutineInfo(funcOp, mapping.second);
+      mlir::emitWarning(mod.getLoc(),
+                        llvm::Twine("function '") + llvm::Twine(mapping.first) +
+                            llvm::Twine("' in acc routine directive is not "
+                                        "found in this translation unit."));
+    else
+      attachRoutineInfo(funcOp, mapping.second);
   }
   accRoutineInfos.clear();
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/70964


More information about the flang-commits mailing list