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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri May 2 16:48:27 PDT 2025


Author: Reid Kleckner
Date: 2025-05-02T16:48:24-07:00
New Revision: 880de1cae2e50e28984e56f97689e39bd60e12a3

URL: https://github.com/llvm/llvm-project/commit/880de1cae2e50e28984e56f97689e39bd60e12a3
DIFF: https://github.com/llvm/llvm-project/commit/880de1cae2e50e28984e56f97689e39bd60e12a3.diff

LOG: [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

Added: 
    

Modified: 
    mlir/include/mlir/Pass/Pass.h
    mlir/lib/Pass/Pass.cpp

Removed: 
    


################################################################################
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