[flang-commits] [flang] [flang] Regularize TODO messages for coarray intrinsics (PR #70281)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Wed Oct 25 19:06:32 PDT 2023


https://github.com/psteinfeld created https://github.com/llvm/llvm-project/pull/70281

Apply a tag to coarray intrinsics to make them easier to recognize along with other coarray constructs.

See pull request #69227 for a similar change.

>From 2b3fc46079f17b4395ab96a2a0e3b61e37cedaeb Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Wed, 25 Oct 2023 19:02:37 -0700
Subject: [PATCH] [flang] Regularize TODO  messages for coarray intrinsics

Apply a tag to coarray intrinsics to make them easier to recognize along
with other coarray constructs.

See pull request #69227 for a similar change.
---
 flang/lib/Optimizer/Builder/IntrinsicCall.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index 0a023bc6b21ea03..fe40fd821f01013 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -1343,6 +1343,12 @@ static bool isIntrinsicModuleProcedure(llvm::StringRef name) {
          name.startswith("ieee_") || name.startswith("__ppc_");
 }
 
+static bool isCoarrayIntrinsic(llvm::StringRef name) {
+  return name.startswith("atomic_") || name.startswith("co_") ||
+         name.contains("image") || name.endswith("cobound") ||
+         name.equals("team_number");
+}
+
 /// Return the generic name of an intrinsic module procedure specific name.
 /// Remove any "__builtin_" prefix, and any specific suffix of the form
 /// {_[ail]?[0-9]+}*, such as _1 or _a4.
@@ -1363,6 +1369,8 @@ llvm::StringRef genericName(llvm::StringRef specificName) {
 void crashOnMissingIntrinsic(mlir::Location loc, llvm::StringRef name) {
   if (isIntrinsicModuleProcedure(name))
     TODO(loc, "intrinsic module procedure: " + llvm::Twine(name));
+  else if (isCoarrayIntrinsic(name))
+    TODO(loc, "coarray: intrinsic " + llvm::Twine(name));
   else
     TODO(loc, "intrinsic: " + llvm::Twine(name));
 }



More information about the flang-commits mailing list