[Mlir-commits] [mlir] [mlir] Declare explicit typeid to fix dylib build (PR #138357)
Reid Kleckner
llvmlistbot at llvm.org
Fri May 2 16:02:44 PDT 2025
https://github.com/rnk created https://github.com/llvm/llvm-project/pull/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
>From ebf7c39808405458d8975eedf95e023af66741ef Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk at google.com>
Date: Fri, 2 May 2025 15:57:46 -0700
Subject: [PATCH] [mlir] Declare explicit typeid to fix dylib build
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
---
mlir/include/mlir/Pass/Pass.h | 5 +++--
mlir/lib/Pass/Pass.cpp | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
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
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list