[Mlir-commits] [flang] [mlir] [mlir][OpenMP] Separate OutlinableInterface from taskloop LoopWrapper (PR #188068)
Sergio Afonso
llvmlistbot at llvm.org
Wed Apr 1 08:35:44 PDT 2026
================
@@ -3332,7 +3279,15 @@ void TaskloopOp::build(OpBuilder &builder, OperationState &state,
makeArrayAttr(ctx, clauses.reductionSyms), clauses.untied);
}
+TaskloopContextOp TaskloopOp::getContextOp() {
+ return getOperation()->getParentOfType<TaskloopContextOp>();
----------------
skatrak wrote:
This would pick up the context op in a case like this:
```mlir
omp.taskloop.context {
some.op {
omp.taskloop {
...
}
...
}
// If there's another omp.taskloop here, verifiers for all three ops will pass. Also the case for nested omp.taskloops with a single omp.taskloop.context.
}
```
That's probably unintended, since `TaskloopContextOp::getLoopOp()` only looks at direct children of `omp.taskloop.context`. Also, I wouldn't call `TaskloopOp::getContextOp` from the verifier so that we can never return `null` here, after the verifier has made sure that the parent is indeed a `TaskloopContextOp`, but feel free to ignore that part since it's not so important.
```suggestion
return cast<TaskloopContextOp>(getOperation()->getParentOp());
```
https://github.com/llvm/llvm-project/pull/188068
More information about the Mlir-commits
mailing list