[Mlir-commits] [mlir] [MLIR] Make MLIRRegisterAllPasses depend on mlir-headers (PR #196913)

Fujun Han llvmlistbot at llvm.org
Mon May 11 04:14:30 PDT 2026


https://github.com/Peter9606 updated https://github.com/llvm/llvm-project/pull/196913

>From 430d3830532be0f164e1624cce18f8a9cf7e786e Mon Sep 17 00:00:00 2001
From: Fujun Han <fujun.han at iluvatar.com>
Date: Mon, 11 May 2026 17:40:51 +0800
Subject: [PATCH] [MLIR] Make MLIRRegisterAllPasses depend on mlir-headers

RegisterAllPasses.cpp includes dialect Transforms/Passes.h headers that pull
in generated Passes.h.inc files. Those are produced by mlir-tblgen targets
that add_dependencies(mlir-headers ...). add_mlir_library only appended
mlir-generic-headers by default, so this TU could compile too early relative
to TableGen outputs and registerAllPasses() could miss newly added passes.

Signed-off-by: Fujun Han <fujun.han at iluvatar.com>
Co-authored-by: Cursor <cursoragent at cursor.com>
---
 mlir/lib/CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt
index d7a6e28d98586..576942b78f4a8 100644
--- a/mlir/lib/CMakeLists.txt
+++ b/mlir/lib/CMakeLists.txt
@@ -41,6 +41,12 @@ add_mlir_library(MLIRRegisterAllPasses
 
   PARTIAL_SOURCES_INTENDED
 
+  # This TU includes dialect pass registration headers that depend on
+  # TableGen outputs (e.g. Passes.h.inc) wired into mlir-headers. Without this
+  # dependency it may compile before those headers are regenerated.
+  DEPENDS
+  mlir-headers
+
   LINK_LIBS PUBLIC
   ${dialect_libs} # Some passes are part of the dialect libs
   ${conversion_libs}



More information about the Mlir-commits mailing list