[Mlir-commits] [mlir] [mlir] Declare explicit typeid to fix dylib build (PR #138357)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri May 2 16:03:18 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Reid Kleckner (rnk)

<details>
<summary>Changes</summary>

This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes #<!-- -->138202


---
Full diff: https://github.com/llvm/llvm-project/pull/138357.diff


2 Files Affected:

- (modified) mlir/include/mlir/Pass/Pass.h (+3-2) 
- (modified) mlir/lib/Pass/Pass.cpp (+2) 


``````````diff
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 7725a3a2910bd..9e8ba7158f1b3 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -493,8 +493,6 @@ class PassExecutionAction : public tracing::ActionImpl<PassExecutionAction> {
   using Base = tracing::ActionImpl<PassExecutionAction>;
 
 public:
-  /// Define a TypeID for this PassExecutionAction.
-  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PassExecutionAction)
   /// Construct a PassExecutionAction. This is called by the OpToOpPassAdaptor
   /// when it calls `executeAction`.
   PassExecutionAction(ArrayRef<IRUnit> irUnits, const Pass &pass);
@@ -526,4 +524,7 @@ class PassExecutionAction : public tracing::ActionImpl<PassExecutionAction> {
 
 } // namespace mlir
 
+/// Define a TypeID for this PassExecutionAction.
+MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::PassExecutionAction)
+
 #endif // MLIR_PASS_PASS_H
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 67c18189b85e0..8d1fbcdb19a9d 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -51,6 +51,8 @@ Operation *PassExecutionAction::getOp() const {
                          : llvm::dyn_cast_if_present<Operation *>(irUnits[0]);
 }
 
+MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::PassExecutionAction)
+
 //===----------------------------------------------------------------------===//
 // Pass
 //===----------------------------------------------------------------------===//

``````````

</details>


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


More information about the Mlir-commits mailing list