[Mlir-commits] [flang] [mlir] [mlir][acc] Add utilities for acc dialect (PR #164022)

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Fri Oct 17 15:12:38 PDT 2025


================
@@ -0,0 +1,83 @@
+//===- OpenACCUtils.cpp ---------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/OpenACC/OpenACCUtils.h"
+
+#include "mlir/Dialect/OpenACC/OpenACC.h"
+#include "llvm/ADT/TypeSwitch.h"
+
+mlir::Operation *mlir::acc::getEnclosingComputeOp(mlir::Region &region) {
+  mlir::Operation *parentOp = region.getParentOp();
+  while (parentOp) {
+    if (mlir::isa<ACC_COMPUTE_CONSTRUCT_OPS>(parentOp)) {
+      return parentOp;
+    }
----------------
clementval wrote:

no braces

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


More information about the Mlir-commits mailing list