Skip to content

Commit 7691b69

Browse files
author
Jeff Niu
committed
[mlir][cmake] Don't add dependencies on mlir-(generic-)headers
Every dialect was dependent on `mlir-headers`, which was causing the build of any single MLIR dialect to pull in a bunch of extra dependencies that aren't needed. Now, MLIR dialects will need to explicitly depend on `MLIR*IncGen` targets to pull in any needed headers. This does not impact the actual `mlir-header` target. Consider the "simple" Arithmetic dialect. Before: ``` % ninja MLIRArithmeticDialect [151/812] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/JSONBackend.cpp.o ``` After: ``` % ninja MLIRArithmeticDialect [207/374] Building CXX object tools/mlir/lib/TableGen/CMakeFiles/MLIRTableGen.dir/GenInfo.cpp.o ``` (Both clean builds) Reviewed By: rriddle, jpienaar Differential Revision: https://reviews.llvm.org/D133132
1 parent bf7a744 commit 7691b69

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,19 +577,19 @@ endfunction()
577577
# Declare the library associated with a dialect.
578578
function(add_mlir_dialect_library name)
579579
set_property(GLOBAL APPEND PROPERTY MLIR_DIALECT_LIBS ${name})
580-
add_mlir_library(${ARGV} DEPENDS mlir-headers)
580+
add_mlir_library(${ARGV})
581581
endfunction(add_mlir_dialect_library)
582582

583583
# Declare the library associated with a conversion.
584584
function(add_mlir_conversion_library name)
585585
set_property(GLOBAL APPEND PROPERTY MLIR_CONVERSION_LIBS ${name})
586-
add_mlir_library(${ARGV} DEPENDS mlir-headers)
586+
add_mlir_library(${ARGV})
587587
endfunction(add_mlir_conversion_library)
588588

589589
# Declare the library associated with a translation.
590590
function(add_mlir_translation_library name)
591591
set_property(GLOBAL APPEND PROPERTY MLIR_TRANSLATION_LIBS ${name})
592-
add_mlir_library(${ARGV} DEPENDS mlir-headers)
592+
add_mlir_library(${ARGV})
593593
endfunction(add_mlir_translation_library)
594594

595595
# Verification tools to aid debugging.

mlir/lib/Analysis/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ add_mlir_library(MLIRAnalysis
3434
ADDITIONAL_HEADER_DIRS
3535
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
3636

37-
DEPENDS
38-
mlir-headers
39-
4037
LINK_LIBS PUBLIC
4138
MLIRCallInterfaces
4239
MLIRControlFlowInterfaces

mlir/lib/Dialect/Transform/IR/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_mlir_dialect_library(MLIRTransformDialect
66
DEPENDS
77
MLIRTransformDialectIncGen
88
MLIRTransformInterfacesIncGen
9+
MLIRTransformOpsIncGen
910

1011
LINK_LIBS PUBLIC
1112
MLIRIR

mlir/lib/Pass/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ add_mlir_library(MLIRPass
1010
ADDITIONAL_HEADER_DIRS
1111
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
1212

13-
DEPENDS
14-
mlir-generic-headers
15-
1613
LINK_LIBS PUBLIC
1714
MLIRAnalysis
1815
MLIRIR

mlir/lib/Rewrite/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ add_mlir_library(MLIRRewrite
66
ADDITIONAL_HEADER_DIRS
77
${MLIR_MAIN_INCLUDE_DIR}/mlir/Rewrite
88

9-
DEPENDS
10-
mlir-generic-headers
11-
129
LINK_LIBS PUBLIC
1310
MLIRIR
1411
MLIRPDLDialect

0 commit comments

Comments
 (0)