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

RegisterAllPasses.cpp pulls in dialect Passes.h / generated Passes.h.inc
via TableGen targets that are tied to mlir-headers, but add_mlir_library
only adds mlir-generic-headers by default, so this TU can compile before
those generated headers are ready and registerAllPasses() can miss
passes (e.g. sporadic mlir-opt --help gaps). Add DEPENDS mlir-headers to
MLIRRegisterAllPasses in mlir/lib/CMakeLists.txt so it waits for those
outputs. Verified with ninja mlir-opt and mlir-opt --help | grep -E
'nvvm-attach-target|rocdl-attach-target' (or similar stable upstream
passes in your tree).

Signed-off-by: Fujun Han <fujun.han@iluvatar.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fujun Han 2026-05-11 19:26:55 +08:00 committed by GitHub
parent 2c0d0e1b3b
commit 72188570e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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}