[mlir] Declare explicit typeid to fix dylib build (#138357)
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
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 7725a3a..9e8ba71 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -493,8 +493,6 @@
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 @@
} // 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 67c1818..8d1fbcd 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -51,6 +51,8 @@
: llvm::dyn_cast_if_present<Operation *>(irUnits[0]);
}
+MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::PassExecutionAction)
+
//===----------------------------------------------------------------------===//
// Pass
//===----------------------------------------------------------------------===//