[Mlir-commits] [mlir] [mlir][OpenMP] Convert omp.cancel parallel to LLVMIR (PR #137192)

Tom Eccles llvmlistbot at llvm.org
Fri Apr 25 06:56:08 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)) {
----------------
tblah wrote:

The [verifier](https://github.com/llvm/llvm-project/blob/ade502a8c46b8393e022b4eabcdd445af91a451c/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp#L3175) checks that the clause cancellation construct type matches so I am taking that for granted here.

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


More information about the Mlir-commits mailing list