[Mlir-commits] [mlir] [mlir][OpenMP] Convert omp.cancel parallel to LLVMIR (PR #137192)
Sergio Afonso
llvmlistbot at llvm.org
Fri Apr 25 05:47:36 PDT 2025
================
@@ -1580,6 +1587,21 @@ cleanupPrivateVars(llvm::IRBuilderBase &builder,
return success();
}
+/// Returns true if the construct contains omp.cancel or omp.cancellation_point
+static bool constructIsCancellable(Operation *op) {
+ // omp.cancel must be "closely nested" so it will be visible and not inside of
+ // funcion calls. This is enforced by the verifier.
+ bool containsCancel = false;
+ op->walk([&containsCancel](Operation *child) {
+ if (mlir::isa<omp::CancelOp>(child)) {
+ containsCancel = true;
+ return WalkResult::interrupt();
+ }
+ return WalkResult::advance();
+ });
+ return containsCancel;
----------------
skatrak wrote:
Nit: This can be simplified a bit by doing `return op->walk(...).wasInterrupted();` and remove `containsCancel`.
https://github.com/llvm/llvm-project/pull/137192
More information about the Mlir-commits
mailing list