[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 18 07:53:28 PDT 2024


================
@@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() {
   if (getSimd())
     return failure();
 
-  if (auto container = (*this)->getParentOfType<WsloopOp>()) {
-    if (!container.getOrderedValAttr() ||
-        container.getOrderedValAttr().getInt() != 0)
+  if (auto loopOp = dyn_cast<LoopNestOp>((*this)->getParentOp())) {
----------------
skatrak wrote:

I wasn't too sure, so to be conservative I just replicated the previous behavior. However, looking at the OpenMP examples documents, I can see this is allowed:
```c
#pragma omp for ordered
for (i=0; i<n; i++) {
  if (i <= 10) {
    #pragma omp ordered
    work(i);
  }
  if (i > 10) {
    #pragma omp ordered
    work(i+1);
  }
}
```
So my guess is that it's possible that `omp.ordered.region` appears indirectly nested inside of an `omp.loop_nest`.

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


More information about the llvm-branch-commits mailing list