[clang-tools-extra] [mlir][OpenMP] Added `omp.structured_region` operation (PR #68825)

Kiran Chandramohan via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 04:54:01 PDT 2023


================
@@ -1468,6 +1468,18 @@ LogicalResult CancellationPointOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// RegionOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult StructuredRegionOp::verify() {
+  Operation *parentOp = (*this)->getParentOp();
+  assert(parentOp && "'omp.region' op must have a parent");
+  if (!isa<OpenMPDialect>(parentOp->getDialect()))
+    return emitOpError() << "must be used under an OpenMP Dialect operation";
+  return success();
+}
----------------
kiranchandramohan wrote:

This is OK for now, But in future when privatisation is modelled in the dialect for things like the worksharing loop where the bounds can also be privatised, this can be a wrapper around the region.
```
omp.structured_region private(%upper=%x) {
%upper:
  omp.wsloop for  (%i) : i32 = (%c1) to (%upper) inclusive step (%c1) {
  }
}
```

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


More information about the cfe-commits mailing list