[clang] [mlir] [CIR][OpenMP] Add host op filtering pass to CIR pipeline (PR #209592)

Sergio Afonso via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 04:15:05 PDT 2026


================
@@ -473,6 +473,15 @@ def OffloadModuleInterface : OpInterface<"OffloadModuleInterface"> {
            return ::llvm::dyn_cast<BoolAttr>(isTargetDevice).getValue();
         return false;
       }]>,
+    InterfaceMethod<
+      /*description=*/[{
+        Return true if the current module was generated with OpenMP enabled.
+        }],
+      /*retTy=*/"bool",
+      /*methodName=*/"getIsOpenMP",
+      (ins), [{}], [{
+        return $_op->hasAttr("omp.is_target_device");
+      }]>,
----------------
skatrak wrote:

I'm not too convinced about this. The problem is that this attribute is optional and has a default, so a valid OpenMP module can skip it. It's also not something that would belong to the `OffloadModuleInterface`, as it's not offloading-specific.

How about setting an `omp.module` unit module attribute or similar in the frontend and just check for presence where needed?

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


More information about the cfe-commits mailing list