[Mlir-commits] [flang] [mlir] [mlir][OpenMP] Separate OutlinableInterface from taskloop LoopWrapper (PR #188068)

Tom Eccles llvmlistbot at llvm.org
Wed Mar 25 03:33:47 PDT 2026


================
@@ -3232,6 +3232,32 @@ LogicalResult TaskgroupOp::verify() {
                                 getTaskReductionByref());
 }
 
+//===----------------------------------------------------------------------===//
+// TaskloopContextOp
+//===----------------------------------------------------------------------===//
+
+TaskloopOp TaskloopContextOp::getLoopOp() {
+  for (mlir::Operation &op : getRegion().front())
+    if (auto taskloopOp = dyn_cast<TaskloopOp>(&op))
+      return taskloopOp;
+  return nullptr;
+}
+
+LogicalResult TaskloopContextOp::verifyRegions() {
+  Region &region = getRegion();
+  if (region.empty())
+    return emitOpError() << "expected non-empty region";
+
+  auto count = llvm::count_if(
+      region.front(), [](mlir::Operation &op) { return isa<TaskloopOp>(op); });
+  if (count != 1)
+    return emitOpError()
----------------
tblah wrote:

Thanks for taking a look. I've updated the error message to make it clearer that the requirement is for direct nesting.

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


More information about the Mlir-commits mailing list