[clang] [CIR] Add missing MLIR TableGen dependencies to CIR CMake targets (PR #187692)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 20 05:49:38 PDT 2026


https://github.com/mmha created https://github.com/llvm/llvm-project/pull/187692

CIR targets include MLIR headers that depend on TableGen-generated .inc files (BuiltinLocationAttributes.h.inc, BytecodeOpInterface.h.inc), but do not declare build dependencies on the corresponding TableGen targets. This causes intermittent build failures with parallel builds when the .inc files have not yet been generated by the time CIR sources compile.

Add MLIRBuiltinLocationAttributesIncGen and MLIRBytecodeOpInterfaceIncGen to DEPENDS in all affected CIR CMake targets:
- clangCIRLoweringCommon
- clangCIRLoweringDirectToLLVM
- clangCIRFrontendAction
- MLIRCIRInterfaces
- MLIRCIR (Dialect/IR)
- MLIRCIRTransforms
- MLIRCIRTargetLowering
- CIROpenACCSupport
- clangCIR (CodeGen)

>From 9ae642b18a85bc30a9e3ee1aad3533f4999238e2 Mon Sep 17 00:00:00 2001
From: Morris Hafner <mhafner at nvidia.com>
Date: Fri, 20 Mar 2026 12:08:24 +0000
Subject: [PATCH] [CIR] Add missing MLIR TableGen dependencies to CIR CMake
 targets

CIR targets include MLIR headers that depend on TableGen-generated .inc
files (BuiltinLocationAttributes.h.inc, BytecodeOpInterface.h.inc), but
do not declare build dependencies on the corresponding TableGen targets.
This causes intermittent build failures with parallel builds when the
.inc files have not yet been generated by the time CIR sources compile.

Add MLIRBuiltinLocationAttributesIncGen and MLIRBytecodeOpInterfaceIncGen
to DEPENDS in all affected CIR CMake targets:
- clangCIRLoweringCommon
- clangCIRLoweringDirectToLLVM
- clangCIRFrontendAction
- MLIRCIRInterfaces
- MLIRCIR (Dialect/IR)
- MLIRCIRTransforms
- MLIRCIRTargetLowering
- CIROpenACCSupport
- clangCIR (CodeGen)
---
 clang/lib/CIR/CodeGen/CMakeLists.txt                          | 2 ++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt                       | 2 ++
 clang/lib/CIR/Dialect/OpenACC/CMakeLists.txt                  | 2 ++
 clang/lib/CIR/Dialect/Transforms/CMakeLists.txt               | 2 ++
 .../lib/CIR/Dialect/Transforms/TargetLowering/CMakeLists.txt  | 2 ++
 clang/lib/CIR/FrontendAction/CMakeLists.txt                   | 2 ++
 clang/lib/CIR/Interfaces/CMakeLists.txt                       | 2 ++
 clang/lib/CIR/Lowering/CMakeLists.txt                         | 4 ++++
 clang/lib/CIR/Lowering/DirectToLLVM/CMakeLists.txt            | 2 ++
 9 files changed, 20 insertions(+)

diff --git a/clang/lib/CIR/CodeGen/CMakeLists.txt b/clang/lib/CIR/CodeGen/CMakeLists.txt
index 8548cc8424527..1dba45355dbc1 100644
--- a/clang/lib/CIR/CodeGen/CMakeLists.txt
+++ b/clang/lib/CIR/CodeGen/CMakeLists.txt
@@ -55,6 +55,8 @@ add_clang_library(clangCIR
   DEPENDS
   MLIRCIR
   MLIRCIROpInterfacesIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
   ${dialect_libs}
 
   LINK_LIBS
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index 98575941035f2..a828667377f99 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -11,6 +11,8 @@ add_clang_library(MLIRCIR
   MLIRCIREnumsGen
   MLIRCIROpInterfacesIncGen
   MLIRCIRLoopOpInterfaceIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
 
   LINK_LIBS PUBLIC
   MLIRIR
diff --git a/clang/lib/CIR/Dialect/OpenACC/CMakeLists.txt b/clang/lib/CIR/Dialect/OpenACC/CMakeLists.txt
index de27f4cb27c59..83b9d90b041b3 100644
--- a/clang/lib/CIR/Dialect/OpenACC/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/OpenACC/CMakeLists.txt
@@ -4,6 +4,8 @@ add_clang_library(CIROpenACCSupport
 
   DEPENDS
   MLIRCIRTypeConstraintsIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
 
   LINK_LIBS PUBLIC
   MLIRIR
diff --git a/clang/lib/CIR/Dialect/Transforms/CMakeLists.txt b/clang/lib/CIR/Dialect/Transforms/CMakeLists.txt
index 411bbc386b9d1..3c17eaa1548f7 100644
--- a/clang/lib/CIR/Dialect/Transforms/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/Transforms/CMakeLists.txt
@@ -14,6 +14,8 @@ add_clang_library(MLIRCIRTransforms
 
   DEPENDS
   MLIRCIRPassIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
 
   LINK_LIBS PUBLIC
   clangAST
diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/CMakeLists.txt b/clang/lib/CIR/Dialect/Transforms/TargetLowering/CMakeLists.txt
index 92148127424e9..bd81f90a6fbbe 100644
--- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/CMakeLists.txt
@@ -6,6 +6,8 @@ add_clang_library(MLIRCIRTargetLowering
 
   DEPENDS
   clangBasic
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
 
   LINK_COMPONENTS
   TargetParser
diff --git a/clang/lib/CIR/FrontendAction/CMakeLists.txt b/clang/lib/CIR/FrontendAction/CMakeLists.txt
index 50d6ea7108ce1..8eb8a60e0a0cf 100644
--- a/clang/lib/CIR/FrontendAction/CMakeLists.txt
+++ b/clang/lib/CIR/FrontendAction/CMakeLists.txt
@@ -11,6 +11,8 @@ add_clang_library(clangCIRFrontendAction
   DEPENDS
   MLIRCIROpsIncGen
   MLIRCIROpInterfacesIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
   MLIRBuiltinOpsIncGen
 
   LINK_LIBS
diff --git a/clang/lib/CIR/Interfaces/CMakeLists.txt b/clang/lib/CIR/Interfaces/CMakeLists.txt
index 33eb169708a4f..ec22a02bbb63a 100644
--- a/clang/lib/CIR/Interfaces/CMakeLists.txt
+++ b/clang/lib/CIR/Interfaces/CMakeLists.txt
@@ -13,6 +13,8 @@ add_clang_library(MLIRCIRInterfaces
   MLIRCIRTypeInterfacesIncGen
   MLIRCIRLoopOpInterfaceIncGen
   MLIRCIROpInterfacesIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
 
   LINK_LIBS
   ${dialect_libs}
diff --git a/clang/lib/CIR/Lowering/CMakeLists.txt b/clang/lib/CIR/Lowering/CMakeLists.txt
index 28ec3c551018c..bc7d339ffb62d 100644
--- a/clang/lib/CIR/Lowering/CMakeLists.txt
+++ b/clang/lib/CIR/Lowering/CMakeLists.txt
@@ -9,6 +9,10 @@ add_clang_library(clangCIRLoweringCommon
   CIRPasses.cpp
   LoweringHelpers.cpp
 
+  DEPENDS
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
+
   LINK_LIBS
   clangCIR
   ${dialect_libs}
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/CMakeLists.txt b/clang/lib/CIR/Lowering/DirectToLLVM/CMakeLists.txt
index c7467fe40ba30..7c91d9bc63fa4 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/CMakeLists.txt
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/CMakeLists.txt
@@ -12,6 +12,8 @@ add_clang_library(clangCIRLoweringDirectToLLVM
   DEPENDS
   MLIRCIREnumsGen
   MLIRCIROpsIncGen
+  MLIRBuiltinLocationAttributesIncGen
+  MLIRBytecodeOpInterfaceIncGen
   MLIRCIROpInterfacesIncGen
 
   LINK_LIBS



More information about the cfe-commits mailing list