[llvm] [bazel] Add support for --incompatible_disallow_empty_glob (PR #85999)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 12:58:36 PDT 2024


https://github.com/keith created https://github.com/llvm/llvm-project/pull/85999

This bazel flag, that should be flipped in an upcoming release https://github.com/bazelbuild/bazel/pull/15327, fails if globs have no matches. This helps find libraries where you are accidentally not including files because of typos. This change removes the various globs that were not matching anything, and uncovered some targets that were doing nothing because their source files were deleted. There are a few cases where globs were intentionally optional in the case of loops that expanded to different potential options, so those now use `allow_empty = True`. This allows downstream consumers to also flip this flags for their own builds, where previously this would fail in LLVM instead.

The downside to this change is that if files are added in these relatively standard locations, manual work will have to be done to add this patterns back. If folks prefer we could instead add `allow_empty = True` to every glob.

>From 604e9f5b9a8cbb783cf8de4534421a89c36502c0 Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Wed, 20 Mar 2024 12:25:39 -0700
Subject: [PATCH] [bazel] Add support for --incompatible_disallow_empty_glob

This bazel flag, that should be flipped in an upcoming release
https://github.com/bazelbuild/bazel/pull/15327, fails if globs have no
matches. This helps find libraries where you are accidentally not
including files because of typos. This change removes the various globs
that were not matching anything, and uncovered some targets that were
doing nothing because their source files were deleted. There are a few
cases where globs were intentionally optional in the case of loops that
expanded to different potential options, so those now use
`allow_empty = True`. This allows downstream consumers to also flip this
flags for their own builds, where previously this would fail in LLVM
instead.

The downside to this change is that if files are added in these
relatively standard locations, manual work will have to be done to add
this patterns back. If folks prefer we could instead add
`allow_empty = True` to every glob.
---
 utils/bazel/.bazelrc                          |   4 +
 .../llvm-project-overlay/bolt/BUILD.bazel     |   2 -
 .../clang-tools-extra/clang-tidy/defs.bzl     |   4 +-
 .../llvm-project-overlay/clang/BUILD.bazel    |  22 +-
 .../llvm-project-overlay/lld/BUILD.bazel      |   2 -
 .../llvm-project-overlay/llvm/BUILD.bazel     | 337 +++++++-----------
 .../llvm-project-overlay/mlir/BUILD.bazel     | 143 --------
 .../mlir/test/BUILD.bazel                     |  13 -
 .../mlir/unittests/BUILD.bazel                |  38 --
 9 files changed, 138 insertions(+), 427 deletions(-)

diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc
index c06e9b3416263f..1d7cf4a4df1b11 100644
--- a/utils/bazel/.bazelrc
+++ b/utils/bazel/.bazelrc
@@ -30,6 +30,10 @@ build --features=layering_check
 # See: https://bazel.build/reference/be/functions#exports_files
 build --incompatible_no_implicit_file_export
 
+# Enable so downstream users can flip this flag globally, this should
+# eventually become the default
+common --incompatible_disallow_empty_glob
+
 ###############################################################################
 # Options to select different strategies for linking potential dependent
 # libraries. The default leaves it disabled.
diff --git a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel b/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
index 043a3b61a75f03..1c12c8167ba469 100644
--- a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
@@ -221,8 +221,6 @@ cc_library(
     srcs = glob([
         "lib/Target/AArch64/*.cpp",
     ]),
-    hdrs = glob([
-    ]),
     includes = ["include"],
     deps = [
         ":Core",
diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl
index 41c03aad871c71..5abe4b08f5d98a 100644
--- a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl
@@ -16,8 +16,8 @@ _common_library_deps = [
 ]
 
 def clang_tidy_library(name, **kwargs):
-    kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")]))
-    kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")]))
+    kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")], allow_empty = True))
+    kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")], allow_empty=True))
     kwargs["deps"] = kwargs.get("deps", []) + _common_library_deps
     cc_library(
         name = name,
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index 865cafbf50c63e..c01986815afe11 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -614,7 +614,6 @@ cc_library(
         "include/clang/Basic/Version.inc",
     ] + glob([
         "lib/Basic/*.cpp",
-        "lib/Basic/*.c",
         "lib/Basic/*.h",
         "lib/Basic/Targets/*.cpp",
         "lib/Basic/Targets/*.h",
@@ -1042,7 +1041,6 @@ cc_library(
         "lib/Analysis/FlowSensitive/Models/*.cpp",
         "lib/Analysis/FlowSensitive/*.cpp",
         "lib/Analysis/*.cpp",
-        "lib/Analysis/*.h",
     ]) + [
         ":analysis_htmllogger_gen",
     ],
@@ -1180,10 +1178,8 @@ gentbl(
 
 cc_library(
     name = "parse",
-    srcs = [
-    ] + glob([
+    srcs = glob([
         "lib/Parse/*.cpp",
-        "lib/Parse/*.h",
     ]),
     hdrs = [
         "include/clang/Parse/AttrParserStringSwitches.inc",
@@ -1207,7 +1203,6 @@ cc_library(
     name = "ast_matchers",
     srcs = glob([
         "lib/ASTMatchers/*.cpp",
-        "lib/ASTMatchers/*.h",
     ]),
     hdrs = glob(["include/clang/ASTMatchers/*.h"]),
     includes = ["include"],
@@ -1241,7 +1236,6 @@ cc_library(
     name = "rewrite",
     srcs = glob([
         "lib/Rewrite/*.cpp",
-        "lib/Rewrite/*.h",
     ]),
     hdrs = glob(["include/clang/Rewrite/Core/*.h"]),
     includes = ["include"],
@@ -1275,7 +1269,6 @@ cc_library(
     name = "tooling_core",
     srcs = glob([
         "lib/Tooling/Core/*.cpp",
-        "lib/Tooling/Core/*.h",
     ]),
     hdrs = glob(["include/clang/Tooling/Core/*.h"]),
     includes = ["include"],
@@ -1340,11 +1333,9 @@ cc_library(
     name = "tooling_refactoring",
     srcs = glob([
         "lib/Tooling/Refactoring/**/*.cpp",
-        "lib/Tooling/Refactoring/**/*.h",
     ]),
     hdrs = glob([
         "include/clang/Tooling/Refactoring/**/*.h",
-        "include/clang/Tooling/Refactoring/**/*.def",
     ]),
     deps = [
         ":ast",
@@ -1593,9 +1584,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Driver/*.cpp",
-            "lib/Driver/*.h",
-            "lib/Driver/Arch/*.cpp",
-            "lib/Driver/Arch/*.h",
             "lib/Driver/ToolChains/*.cpp",
             "lib/Driver/ToolChains/*.h",
             "lib/Driver/ToolChains/Arch/*.cpp",
@@ -1833,9 +1821,6 @@ cc_library(
     copts = ["$(STACK_FRAME_UNLIMITED)"],
     data = [":builtin_headers_gen"],
     includes = ["include"],
-    textual_hdrs = glob([
-        "include/clang/Frontend/*.def",
-    ]),
     deps = [
         ":apinotes",
         ":ast",
@@ -1872,7 +1857,6 @@ cc_library(
     name = "frontend_rewrite",
     srcs = glob([
         "lib/Frontend/Rewrite/*.cpp",
-        "lib/Frontend/Rewrite/*.h",
     ]),
     hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]),
     includes = ["include"],
@@ -2116,7 +2100,6 @@ cc_library(
     name = "frontend_tool",
     srcs = glob([
         "lib/FrontendTool/*.cpp",
-        "lib/FrontendTool/*.h",
     ]),
     hdrs = glob(["include/clang/FrontendTool/*.h"]),
     includes = ["include"],
@@ -2320,7 +2303,6 @@ cc_binary(
     testonly = 1,
     srcs = glob([
         "tools/clang-import-test/*.cpp",
-        "tools/clang-import-test/*.h",
     ]),
     stamp = 0,
     deps = [
@@ -2350,7 +2332,6 @@ cc_library(
     name = "clang-driver",
     srcs = glob([
         "tools/driver/*.cpp",
-        "tools/driver/*.h",
     ]) + ["clang-driver.cpp"],
     copts = [
         # Disable stack frame size checks in the driver because
@@ -2668,7 +2649,6 @@ cc_library(
     name = "extract_api",
     srcs = glob([
         "lib/ExtractAPI/**/*.cpp",
-        "lib/ExtractAPI/**/*.h",
     ]),
     hdrs = glob(["include/clang/ExtractAPI/**/*.h"]),
     includes = ["include"],
diff --git a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
index 8fb71fc1f971e5..5a494a13acea2d 100644
--- a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
@@ -187,7 +187,6 @@ cc_library(
     name = "MinGW",
     srcs = glob([
         "MinGW/*.cpp",
-        "MinGW/*.h",
     ]),
     includes = ["MinGW"],
     deps = [
@@ -296,7 +295,6 @@ cc_binary(
     name = "lld",
     srcs = glob([
         "tools/lld/*.cpp",
-        "tools/lld/*.h",
     ]) + ["lld-driver.cpp"],
     deps = [
         ":COFF",
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index 4802daa66286ef..e9af40de97d4ac 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -66,7 +66,10 @@ enum_targets_gen(
 llvm_target_asm_parsers = [
     t
     for t in llvm_targets
-    if glob(["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)])
+    if glob(
+        ["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)],
+        allow_empty = True,
+    )
 ]
 
 enum_targets_gen(
@@ -81,7 +84,10 @@ enum_targets_gen(
 llvm_target_disassemblers = [
     t
     for t in llvm_targets
-    if glob(["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)])
+    if glob(
+        ["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)],
+        allow_empty = True,
+    )
 ]
 
 enum_targets_gen(
@@ -96,7 +102,10 @@ enum_targets_gen(
 llvm_target_mcas = [
     t
     for t in llvm_targets
-    if glob(["lib/Target/{}/MCA/CMakeLists.txt".format(t)])
+    if glob(
+        ["lib/Target/{}/MCA/CMakeLists.txt".format(t)],
+        allow_empty = True,
+    )
 ]
 
 enum_targets_gen(
@@ -111,7 +120,10 @@ enum_targets_gen(
 llvm_target_exegesis = [
     t
     for t in llvm_targets
-    if glob(["tools/llvm-exegesis/lib/{}/CMakeLists.txt".format(t)])
+    if glob(
+        ["tools/llvm-exegesis/lib/{}/CMakeLists.txt".format(t)],
+        allow_empty = True,
+    )
 ]
 
 enum_targets_gen(
@@ -168,7 +180,6 @@ cc_library(
     name = "Demangle",
     srcs = glob([
         "lib/Demangle/*.cpp",
-        "lib/Demangle/*.h",
     ]),
     hdrs = glob([
         "include/llvm/Demangle/*.h",
@@ -203,7 +214,6 @@ cc_library(
         "include/llvm/Option/*.h",
     ]) + select({
         "@platforms//os:windows": glob([
-            "lib/Support/Windows/*.h",
             "lib/Support/Windows/*.inc",
         ]),
         "//conditions:default": glob([
@@ -315,7 +325,6 @@ cc_library(
     name = "LineEditor",
     srcs = glob([
         "lib/LineEditor/*.cpp",
-        "lib/LineEditor/*.h",
     ]),
     hdrs = glob(["include/llvm/LineEditor/*.h"]),
     copts = llvm_copts,
@@ -329,7 +338,6 @@ cc_library(
     name = "Option",
     srcs = glob([
         "lib/Option/*.cpp",
-        "lib/Option/*.h",
     ]),
     hdrs = glob(["include/llvm/Option/*.h"]),
     copts = llvm_copts,
@@ -376,8 +384,6 @@ cc_library(
     name = "BinaryFormat",
     srcs = glob([
         "lib/BinaryFormat/*.cpp",
-        "lib/BinaryFormat/*.def",
-        "lib/BinaryFormat/*.h",
     ]),
     hdrs = glob([
         "include/llvm/BinaryFormat/*.h",
@@ -409,7 +415,6 @@ cc_library(
     name = "DebugInfoMSF",
     srcs = glob([
         "lib/DebugInfo/MSF/*.cpp",
-        "lib/DebugInfo/MSF/*.h",
     ]),
     hdrs = glob(["include/llvm/DebugInfo/MSF/*.h"]),
     copts = llvm_copts,
@@ -420,7 +425,6 @@ cc_library(
     name = "DebugInfoBTF",
     srcs = glob([
         "lib/DebugInfo/BTF/*.cpp",
-        "lib/DebugInfo/BTF/*.h",
     ]),
     hdrs = glob(["include/llvm/DebugInfo/BTF/*.h"]) + [
         "include/llvm/DebugInfo/BTF/BTF.def",
@@ -437,7 +441,6 @@ cc_library(
     name = "DebugInfoCodeView",
     srcs = glob([
         "lib/DebugInfo/CodeView/*.cpp",
-        "lib/DebugInfo/CodeView/*.h",
     ]),
     hdrs = glob([
         "include/llvm/DebugInfo/CodeView/*.h",
@@ -480,9 +483,7 @@ cc_library(
     name = "DebugInfoPDB",
     srcs = glob([
         "lib/DebugInfo/PDB/*.cpp",
-        "lib/DebugInfo/PDB/*.h",
         "lib/DebugInfo/PDB/Native/*.cpp",
-        "lib/DebugInfo/PDB/Native/*.h",
     ]),
     hdrs = glob([
         "include/llvm/DebugInfo/PDB/*.h",
@@ -523,12 +524,9 @@ cc_library(
     name = "MC",
     srcs = glob([
         "lib/MC/*.cpp",
-        "lib/MC/*.h",
     ]),
     hdrs = glob([
         "include/llvm/MC/*.h",
-        "include/llvm/MC/*.def",
-        "include/llvm/MC/*.inc",
     ]),
     copts = llvm_copts,
     deps = [
@@ -545,7 +543,6 @@ cc_library(
     name = "DebugInfoDWARF",
     srcs = glob([
         "lib/DebugInfo/DWARF/*.cpp",
-        "lib/DebugInfo/DWARF/*.h",
     ]),
     hdrs = glob(["include/llvm/DebugInfo/DWARF/*.h"]),
     copts = llvm_copts,
@@ -563,7 +560,6 @@ cc_library(
     name = "DebugInfoGSYM",
     srcs = glob([
         "lib/DebugInfo/GSYM/*.cpp",
-        "lib/DebugInfo/GSYM/*.h",
     ]),
     hdrs = glob(["include/llvm/DebugInfo/GSYM/*.h"]),
     copts = llvm_copts,
@@ -580,7 +576,6 @@ cc_library(
     name = "Symbolize",
     srcs = glob([
         "lib/DebugInfo/Symbolize/*.cpp",
-        "lib/DebugInfo/Symbolize/*.h",
     ]),
     hdrs = glob([
         "include/llvm/DebugInfo/Symbolize/*.h",
@@ -658,7 +653,6 @@ cc_binary(
     srcs = glob(
         [
             "utils/TableGen/*.cpp",
-            "utils/TableGen/*.inc",
             "utils/TableGen/*.h",
             "utils/TableGen/GlobalISel/*.cpp",
             "utils/TableGen/GlobalISel/*.h",
@@ -821,7 +815,6 @@ cc_library(
     name = "BitstreamReader",
     srcs = glob([
         "lib/Bitstream/Reader/*.cpp",
-        "lib/Bitstream/Reader/*.h",
     ]),
     hdrs = [
         "include/llvm/Bitstream/BitCodeEnums.h",
@@ -836,9 +829,6 @@ cc_library(
 
 cc_library(
     name = "BitstreamWriter",
-    srcs = glob([
-        "lib/Bitstream/Writer/*.h",
-    ]),
     hdrs = [
         "include/llvm/Bitstream/BitCodeEnums.h",
         "include/llvm/Bitstream/BitCodes.h",
@@ -956,7 +946,6 @@ cc_library(
     name = "MCParser",
     srcs = glob([
         "lib/MC/MCParser/*.cpp",
-        "lib/MC/MCParser/*.h",
     ]),
     hdrs = glob(["include/llvm/MC/MCParser/*.h"]),
     copts = llvm_copts,
@@ -1002,9 +991,7 @@ cc_library(
     srcs = glob([
         "lib/TextAPI/BinaryReader/**/*.cpp",
     ]),
-    hdrs = ["include/llvm/TextAPI/DylibReader.h"] + glob(
-        ["lib/TextAPI/BinaryReader/**/*.h"],
-    ),
+    hdrs = ["include/llvm/TextAPI/DylibReader.h"],
     copts = llvm_copts,
     deps = [
         ":Object",
@@ -1067,7 +1054,6 @@ cc_library(
     name = "ObjectYAML",
     srcs = glob([
         "lib/ObjectYAML/*.cpp",
-        "lib/ObjectYAML/*.h",
     ]),
     hdrs = glob(["include/llvm/ObjectYAML/*.h"]),
     copts = llvm_copts,
@@ -1085,7 +1071,6 @@ cc_library(
     name = "ProfileData",
     srcs = glob([
         "lib/ProfileData/*.cpp",
-        "lib/ProfileData/*.h",
     ]),
     hdrs = glob([
         "include/llvm/ProfileData/*.h",
@@ -1109,7 +1094,6 @@ cc_library(
     name = "Coverage",
     srcs = glob([
         "lib/ProfileData/Coverage/*.cpp",
-        "lib/ProfileData/Coverage/*.h",
     ]),
     hdrs = glob(["include/llvm/ProfileData/Coverage/*.h"]),
     copts = llvm_copts,
@@ -1126,8 +1110,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Analysis/*.cpp",
-            "lib/Analysis/*.h",
-            "lib/Analysis/*.def",
         ],
     ),
     hdrs = glob(
@@ -1185,7 +1167,6 @@ cc_library(
     name = "Target",
     srcs = glob([
         "lib/Target/*.cpp",
-        "lib/Target/*.h",
     ]),
     hdrs = glob([
         "include/llvm/Target/*.h",
@@ -1221,14 +1202,11 @@ cc_library(
     name = "TargetParser",
     srcs = glob([
         "lib/TargetParser/*.cpp",
-        "lib/TargetParser/*.h",
     ]) + select({
         "@platforms//os:windows": glob([
-            "lib/TargetParser/Windows/*.h",
             "lib/TargetParser/Windows/*.inc",
         ]),
         "//conditions:default": glob([
-            "lib/TargetParser/Unix/*.h",
             "lib/TargetParser/Unix/*.inc",
         ]),
     }),
@@ -1252,7 +1230,6 @@ cc_library(
     name = "DWP",
     srcs = glob([
         "lib/DWP/*.cpp",
-        "lib/DWP/*.h",
     ]),
     hdrs = glob(["include/llvm/DWP/*.h"]),
     copts = llvm_copts,
@@ -1269,7 +1246,6 @@ cc_library(
     name = "TransformUtils",
     srcs = glob([
         "lib/Transforms/Utils/*.cpp",
-        "lib/Transforms/Utils/*.h",
     ]),
     hdrs = glob(["include/llvm/Transforms/Utils/*.h"]) + [
         "include/llvm/Transforms/Utils.h",
@@ -1390,7 +1366,6 @@ cc_library(
     name = "Scalar",
     srcs = glob([
         "lib/Transforms/Scalar/*.cpp",
-        "lib/Transforms/Scalar/*.h",
     ]),
     hdrs = glob(["include/llvm/Transforms/Scalar/*.h"]) + [
         "include/llvm/Transforms/Scalar.h",
@@ -1432,9 +1407,6 @@ cc_library(
 
 cc_library(
     name = "FrontendDebug",
-    srcs = glob([
-        "lib/Frontend/Debug/*.cpp",
-    ]),
     hdrs = glob([
         "include/llvm/Frontend/Debug/*.h",
     ]),
@@ -1530,8 +1502,6 @@ cc_library(
     ]),
     hdrs = glob([
         "include/llvm/Frontend/OpenMP/*.h",
-        "include/llvm/Frontend/OpenMP/OMP/*.h",
-        "include/llvm/Frontend/*.h",
     ]) + [
         "include/llvm/Frontend/OpenMP/OMP.h.inc",
         "include/llvm/Frontend/OpenMP/OMP.inc",
@@ -1591,9 +1561,7 @@ cc_library(
     ]) + [
         "include/llvm/Frontend/OpenACC/ACC.inc",
     ],
-    hdrs = glob([
-        "include/llvm/Frontend/OpenACC/*.h",
-    ]) + ["include/llvm/Frontend/OpenACC/ACC.h.inc"],
+    hdrs = ["include/llvm/Frontend/OpenACC/ACC.h.inc"],
     copts = llvm_copts,
     deps = [
         ":Analysis",
@@ -1607,7 +1575,6 @@ cc_library(
     name = "AsmParser",
     srcs = glob([
         "lib/AsmParser/*.cpp",
-        "lib/AsmParser/*.h",
     ]),
     hdrs = glob(["include/llvm/AsmParser/*.h"]),
     copts = llvm_copts,
@@ -1623,7 +1590,6 @@ cc_library(
     name = "IRPrinter",
     srcs = glob([
         "lib/IRPrinter/*.cpp",
-        "lib/IRPrinter/*.h",
     ]),
     hdrs = glob([
         "include/llvm/IRPrinter/*.h",
@@ -1640,7 +1606,6 @@ cc_library(
     name = "IRReader",
     srcs = glob([
         "lib/IRReader/*.cpp",
-        "lib/IRReader/*.h",
     ]),
     hdrs = glob([
         "include/llvm/IRReader/*.h",
@@ -1683,7 +1648,6 @@ cc_library(
     name = "IPO",
     srcs = glob([
         "lib/Transforms/IPO/*.cpp",
-        "lib/Transforms/IPO/*.h",
     ]),
     hdrs = glob([
         "include/llvm/Transforms/IPO/*.h",
@@ -1721,7 +1685,6 @@ cc_library(
     name = "CFGuard",
     srcs = glob([
         "lib/Transforms/CFGuard/*.cpp",
-        "lib/Transforms/CFGuard/*.h",
     ]),
     hdrs = ["include/llvm/Transforms/CFGuard.h"],
     copts = llvm_copts,
@@ -1736,7 +1699,6 @@ cc_library(
     name = "HipStdPar",
     srcs = glob([
         "lib/Transforms/HipStdPar/*.cpp",
-        "lib/Transforms/HipStdPar/*.h",
     ]),
     hdrs = ["include/llvm/Transforms/HipStdPar/HipStdPar.h"],
     copts = llvm_copts,
@@ -1826,7 +1788,6 @@ cc_library(
     copts = llvm_copts,
     textual_hdrs = glob([
         "include/llvm/CodeGen/**/*.def",
-        "include/llvm/CodeGen/**/*.inc",
     ]),
     deps = [
         ":AggressiveInstCombine",
@@ -2305,10 +2266,13 @@ gentbl(
         td_file = "lib/Target/" + target["name"] + "/" + target["short_name"] + ".td",
         td_srcs = [
             ":common_target_td_sources",
-        ] + glob([
-            "lib/Target/" + target["name"] + "/*.td",
-            "lib/Target/" + target["name"] + "/GISel/*.td",
-        ]),
+        ] + glob(
+            [
+                "lib/Target/" + target["name"] + "/*.td",
+                "lib/Target/" + target["name"] + "/GISel/*.td",
+            ],
+            allow_empty = True,
+        ),
         deps = target.get("tbl_deps", []),
     )],
     [cc_library(
@@ -2332,43 +2296,49 @@ gentbl(
     # a number of targets due to crisscrossing inclusion of headers.
     [cc_library(
         name = target["name"] + "UtilsAndDesc",
-        srcs = glob([
-            "lib/Target/" + target["name"] + "/MCTargetDesc/*.cpp",
-            "lib/Target/" + target["name"] + "/Utils/*.cpp",
-
-            # We have to include these headers here as well as in the `hdrs`
-            # below to allow the `.cpp` files to use file-relative-inclusion to
-            # find them, even though consumers of this library use inclusion
-            # relative to the target with the `strip_includes_prefix` of this
-            # library. This mixture is likely incompatible with header modules.
-            "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
-            "lib/Target/" + target["name"] + "/Utils/*.h",
-        ]),
-        hdrs = glob([
-            "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
-            "lib/Target/" + target["name"] + "/Utils/*.h",
-
-            # This a bit of a hack to allow us to expose common, internal
-            # target header files to other libraries within the target via
-            # target-relative includes. This usage of headers is inherently
-            # non-modular as there is a mixture of target-relative inclusion
-            # using this rule and file-relative inclusion using the repeated
-            # listing of these headers in the `srcs` of subsequent rules.
-            "lib/Target/" + target["name"] + "/*.h",
-
-            # FIXME: The entries below should be `textual_hdrs` instead of
-            # `hdrs`, but unfortunately that doesn't work with
-            # `strip_include_prefix`:
-            # https://github.com/bazelbuild/bazel/issues/12424
-            #
-            # Once that issue is fixed and released, we can switch this to
-            # `textual_hdrs` and remove the feature disabling the various Bazel
-            # features (both current and under-development) that motivated the
-            # distinction between these two.
-            "lib/Target/" + target["name"] + "/*.def",
-            "lib/Target/" + target["name"] + "/*.inc",
-            "lib/Target/" + target["name"] + "/MCTargetDesc/*.def",
-        ]),
+        srcs = glob(
+            [
+                "lib/Target/" + target["name"] + "/MCTargetDesc/*.cpp",
+                "lib/Target/" + target["name"] + "/Utils/*.cpp",
+
+                # We have to include these headers here as well as in the `hdrs`
+                # below to allow the `.cpp` files to use file-relative-inclusion to
+                # find them, even though consumers of this library use inclusion
+                # relative to the target with the `strip_includes_prefix` of this
+                # library. This mixture is likely incompatible with header modules.
+                "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
+                "lib/Target/" + target["name"] + "/Utils/*.h",
+            ],
+            allow_empty = True,
+        ),
+        hdrs = glob(
+            [
+                "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
+                "lib/Target/" + target["name"] + "/Utils/*.h",
+
+                # This a bit of a hack to allow us to expose common, internal
+                # target header files to other libraries within the target via
+                # target-relative includes. This usage of headers is inherently
+                # non-modular as there is a mixture of target-relative inclusion
+                # using this rule and file-relative inclusion using the repeated
+                # listing of these headers in the `srcs` of subsequent rules.
+                "lib/Target/" + target["name"] + "/*.h",
+
+                # FIXME: The entries below should be `textual_hdrs` instead of
+                # `hdrs`, but unfortunately that doesn't work with
+                # `strip_include_prefix`:
+                # https://github.com/bazelbuild/bazel/issues/12424
+                #
+                # Once that issue is fixed and released, we can switch this to
+                # `textual_hdrs` and remove the feature disabling the various Bazel
+                # features (both current and under-development) that motivated the
+                # distinction between these two.
+                "lib/Target/" + target["name"] + "/*.def",
+                "lib/Target/" + target["name"] + "/*.inc",
+                "lib/Target/" + target["name"] + "/MCTargetDesc/*.def",
+            ],
+            allow_empty = True,
+        ),
         copts = llvm_copts,
         features = [
             "-parse_headers",
@@ -2392,20 +2362,26 @@ gentbl(
     )],
     [cc_library(
         name = target["name"] + "CodeGen",
-        srcs = glob([
-            "lib/Target/" + target["name"] + "/GISel/*.cpp",
-            "lib/Target/" + target["name"] + "/GISel/*.h",
-            "lib/Target/" + target["name"] + "/*.cpp",
-            "lib/Target/" + target["name"] + "/*.h",
-        ]),
+        srcs = glob(
+            [
+                "lib/Target/" + target["name"] + "/GISel/*.cpp",
+                "lib/Target/" + target["name"] + "/GISel/*.h",
+                "lib/Target/" + target["name"] + "/*.cpp",
+                "lib/Target/" + target["name"] + "/*.h",
+            ],
+            allow_empty = True,
+        ),
         hdrs = ["lib/Target/" + target["name"] + "/" + target["short_name"] + ".h"],
         copts = llvm_copts,
         features = ["-layering_check"],
         strip_include_prefix = "lib/Target/" + target["name"],
-        textual_hdrs = glob([
-            "lib/Target/" + target["name"] + "/*.def",
-            "lib/Target/" + target["name"] + "/*.inc",
-        ]),
+        textual_hdrs = glob(
+            [
+                "lib/Target/" + target["name"] + "/*.def",
+                "lib/Target/" + target["name"] + "/*.inc",
+            ],
+            allow_empty = True,
+        ),
         deps = [
             ":Analysis",
             ":BinaryFormat",
@@ -2430,10 +2406,13 @@ gentbl(
     )],
     [cc_library(
         name = target["name"] + "AsmParser",
-        srcs = glob([
-            "lib/Target/" + target["name"] + "/AsmParser/*.cpp",
-            "lib/Target/" + target["name"] + "/AsmParser/*.h",
-        ]),
+        srcs = glob(
+            [
+                "lib/Target/" + target["name"] + "/AsmParser/*.cpp",
+                "lib/Target/" + target["name"] + "/AsmParser/*.h",
+            ],
+            allow_empty = True,
+        ),
         copts = llvm_copts,
         deps = [
             ":BinaryFormat",
@@ -2464,9 +2443,12 @@ gentbl(
         # `textual_hdrs` and remove the feature disabling the various Bazel
         # features (both current and under-development) that motivated the
         # distinction between these two.
-        hdrs = glob([
-            "lib/Target/" + target["name"] + "/Disassembler/*.h",
-        ]),
+        hdrs = glob(
+            [
+                "lib/Target/" + target["name"] + "/Disassembler/*.h",
+            ],
+            allow_empty = True,
+        ),
         features = [
             "-parse_headers",
             "-header_modules",
@@ -2475,11 +2457,14 @@ gentbl(
     )],
     [cc_library(
         name = target["name"] + "Disassembler",
-        srcs = glob([
-            "lib/Target/" + target["name"] + "/Disassembler/*.cpp",
-            "lib/Target/" + target["name"] + "/Disassembler/*.c",
-            "lib/Target/" + target["name"] + "/Disassembler/*.h",
-        ]),
+        srcs = glob(
+            [
+                "lib/Target/" + target["name"] + "/Disassembler/*.cpp",
+                "lib/Target/" + target["name"] + "/Disassembler/*.c",
+                "lib/Target/" + target["name"] + "/Disassembler/*.h",
+            ],
+            allow_empty = True,
+        ),
         copts = llvm_copts,
         features = ["-layering_check"],
         deps = [
@@ -2497,11 +2482,14 @@ gentbl(
     )],
     [cc_library(
         name = target["name"] + "TargetMCA",
-        srcs = glob([
-            "lib/Target/" + target["name"] + "/MCA/*.cpp",
-            "lib/Target/" + target["name"] + "/MCA/*.c",
-            "lib/Target/" + target["name"] + "/MCA/*.h",
-        ]),
+        srcs = glob(
+            [
+                "lib/Target/" + target["name"] + "/MCA/*.cpp",
+                "lib/Target/" + target["name"] + "/MCA/*.c",
+                "lib/Target/" + target["name"] + "/MCA/*.h",
+            ],
+            allow_empty = True,
+        ),
         copts = llvm_copts,
         features = ["-layering_check"],
         deps = [
@@ -2559,28 +2547,10 @@ cc_library(
     textual_hdrs = ["lib/Passes/PassRegistry.def"],
 )
 
-cc_library(
-    name = "MLPolicies",
-    srcs = glob([
-        "lib/Analysis/ML/*.cpp",
-        "lib/Analysis/ML/*.h",
-    ]),
-    hdrs = glob([
-        "include/llvm/Analysis/ML/*.h",
-    ]),
-    copts = llvm_copts,
-    deps = [
-        ":Analysis",
-        ":Core",
-        ":Support",
-    ],
-)
-
 cc_library(
     name = "Passes",
     srcs = glob([
         "lib/Passes/*.cpp",
-        "lib/Passes/*.h",
     ]),
     hdrs = glob([
         "include/llvm/Passes/*.h",
@@ -2600,7 +2570,6 @@ cc_library(
         ":InstCombine",
         ":Instrumentation",
         ":MC",
-        ":MLPolicies",
         ":ObjCARC",
         ":Scalar",
         ":Support",
@@ -2617,7 +2586,6 @@ cc_library(
     name = "LTO",
     srcs = glob([
         "lib/LTO/*.cpp",
-        "lib/LTO/*.h",
     ]),
     hdrs = glob([
         "include/llvm/LTO/*.h",
@@ -2657,7 +2625,6 @@ cc_library(
     name = "ExecutionEngine",
     srcs = glob([
         "lib/ExecutionEngine/*.cpp",
-        "lib/ExecutionEngine/*.h",
         "lib/ExecutionEngine/RuntimeDyld/*.cpp",
         "lib/ExecutionEngine/RuntimeDyld/*.h",
         "lib/ExecutionEngine/RuntimeDyld/Targets/*.cpp",
@@ -2771,11 +2738,9 @@ cc_library(
     name = "OrcJIT",
     srcs = glob([
         "lib/ExecutionEngine/Orc/*.cpp",
-        "lib/ExecutionEngine/Orc/*.h",
     ]),
     hdrs = glob([
         "include/llvm/ExecutionEngine/Orc/*.h",
-        "include/llvm/ExecutionEngine/Orc/RPC/*.h",
     ]) + [
         "include/llvm-c/LLJIT.h",
         "include/llvm-c/Orc.h",
@@ -2899,7 +2864,6 @@ cc_library(
     name = "DWARFLinker",
     srcs = glob([
         "lib/DWARFLinker/Classic/*.cpp",
-        "lib/DWARFLinker/Classic/*.h",
     ]),
     hdrs = glob(["include/llvm/DWARFLinker/Classic/*.h"]),
     copts = llvm_copts,
@@ -2920,7 +2884,6 @@ cc_library(
     name = "DWARFLinkerBase",
     srcs = glob([
         "lib/DWARFLinker/*.cpp",
-        "lib/DWARFLinker/*.h",
     ]),
     hdrs = glob(["include/llvm/DWARFLinker/*.h"]),
     copts = llvm_copts,
@@ -3011,7 +2974,6 @@ cc_library(
     name = "InterfaceStub",
     srcs = glob([
         "lib/InterfaceStub/*.cpp",
-        "lib/InterfaceStub/*.h",
     ]),
     hdrs = glob([
         "include/llvm/InterfaceStub/*.h",
@@ -3062,7 +3024,6 @@ cc_library(
     name = "MCA",
     srcs = glob([
         "lib/MCA/**/*.cpp",
-        "lib/MCA/**/*.h",
     ]),
     hdrs = glob([
         "include/llvm/MCA/**/*.h",
@@ -3089,7 +3050,6 @@ cc_library(
     name = "XRay",
     srcs = glob([
         "lib/XRay/*.cpp",
-        "lib/XRay/*.h",
     ]),
     hdrs = glob(["include/llvm/XRay/*.h"]),
     copts = llvm_copts,
@@ -3146,21 +3106,24 @@ cc_library(
 
 cc_library(
     name = "Exegesis",
-    srcs = glob([
-        "tools/llvm-exegesis/lib/*.cpp",
-        # We have to include these headers here as well as in the `hdrs` below
-        # to allow the `.cpp` files to use file-relative-inclusion to find
-        # them, even though consumers of this library use inclusion relative to
-        # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this
-        # library. This mixture appears to be incompatible with header modules.
-        "tools/llvm-exegesis/lib/*.h",
-    ] + [
-        "tools/llvm-exegesis/lib/{}/*.cpp".format(t)
-        for t in llvm_target_exegesis
-    ] + [
-        "tools/llvm-exegesis/lib/{}/*.h".format(t)
-        for t in llvm_target_exegesis
-    ]),
+    srcs = glob(
+        [
+            "tools/llvm-exegesis/lib/*.cpp",
+            # We have to include these headers here as well as in the `hdrs` below
+            # to allow the `.cpp` files to use file-relative-inclusion to find
+            # them, even though consumers of this library use inclusion relative to
+            # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this
+            # library. This mixture appears to be incompatible with header modules.
+            "tools/llvm-exegesis/lib/*.h",
+        ] + [
+            "tools/llvm-exegesis/lib/{}/*.cpp".format(t)
+            for t in llvm_target_exegesis
+        ] + [
+            "tools/llvm-exegesis/lib/{}/*.h".format(t)
+            for t in llvm_target_exegesis
+        ],
+        allow_empty = True,
+    ),
     hdrs = glob(["tools/llvm-exegesis/lib/*.h"]),
     copts = llvm_copts,
     features = [
@@ -3334,7 +3297,6 @@ cc_binary(
     name = "llvm-ar",
     srcs = glob([
         "tools/llvm-ar/*.cpp",
-        "tools/llvm-ar/*.h",
     ]) + ["llvm-ar-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -3372,7 +3334,6 @@ cc_binary(
     name = "llvm-as",
     srcs = glob([
         "tools/llvm-as/*.cpp",
-        "tools/llvm-as/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3389,7 +3350,6 @@ cc_binary(
     name = "llvm-bcanalyzer",
     srcs = glob([
         "tools/llvm-bcanalyzer/*.cpp",
-        "tools/llvm-bcanalyzer/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3476,7 +3436,6 @@ cc_binary(
     name = "llvm-cvtres",
     srcs = glob([
         "tools/llvm-cvtres/*.cpp",
-        "tools/llvm-cvtres/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3510,7 +3469,6 @@ cc_binary(
     name = "llvm-cxxmap",
     srcs = glob([
         "tools/llvm-cxxmap/*.cpp",
-        "tools/llvm-cxxmap/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3545,7 +3503,6 @@ cc_binary(
     name = "llvm-cxxfilt",
     srcs = glob([
         "tools/llvm-cxxfilt/*.cpp",
-        "tools/llvm-cxxfilt/*.h",
     ]) + ["llvm-cxxfilt-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -3578,7 +3535,6 @@ cc_binary(
     name = "llvm-debuginfod-find",
     srcs = glob([
         "tools/llvm-debuginfod-find/*.cpp",
-        "tools/llvm-debuginfod-find/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3595,7 +3551,6 @@ cc_binary(
     name = "llvm-dis",
     srcs = glob([
         "tools/llvm-dis/*.cpp",
-        "tools/llvm-dis/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3690,7 +3645,6 @@ cc_binary(
     name = "llvm-dwp",
     srcs = glob([
         "tools/llvm-dwp/*.cpp",
-        "tools/llvm-dwp/*.h",
     ]) + ["llvm-dwp-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -3730,7 +3684,6 @@ cc_binary(
     name = "llvm-extract",
     srcs = glob([
         "tools/llvm-extract/*.cpp",
-        "tools/llvm-extract/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3772,7 +3725,6 @@ cc_binary(
     name = "llvm-gsymutil",
     srcs = glob([
         "tools/llvm-gsymutil/*.cpp",
-        "tools/llvm-gsymutil/*.h",
     ]) + ["llvm-gsymutil-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -3924,7 +3876,6 @@ cc_binary(
     name = "llvm-link",
     srcs = glob([
         "tools/llvm-link/*.cpp",
-        "tools/llvm-link/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -3989,7 +3940,6 @@ cc_binary(
     name = "llvm-lto",
     srcs = glob([
         "tools/llvm-lto/*.cpp",
-        "tools/llvm-lto/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4012,7 +3962,6 @@ cc_binary(
     name = "llvm-lto2",
     srcs = glob([
         "tools/llvm-lto2/*.cpp",
-        "tools/llvm-lto2/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4158,7 +4107,6 @@ cc_binary(
     name = "llvm-mt",
     srcs = glob([
         "tools/llvm-mt/*.cpp",
-        "tools/llvm-mt/*.h",
     ]) + ["llvm-mt-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4195,7 +4143,6 @@ cc_binary(
     name = "llvm-nm",
     srcs = glob([
         "tools/llvm-nm/*.cpp",
-        "tools/llvm-nm/*.h",
     ]) + ["llvm-nm-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4279,7 +4226,6 @@ cc_binary(
     name = "llvm-stress",
     srcs = glob([
         "tools/llvm-stress/*.cpp",
-        "tools/llvm-stress/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4456,7 +4402,6 @@ cc_binary(
     name = "llvm-profdata",
     srcs = glob([
         "tools/llvm-profdata/*.cpp",
-        "tools/llvm-profdata/*.h",
     ]) + ["llvm-profdata-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4640,7 +4585,6 @@ cc_binary(
     name = "llvm-rtdyld",
     srcs = glob([
         "tools/llvm-rtdyld/*.cpp",
-        "tools/llvm-rtdyld/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4682,7 +4626,6 @@ cc_binary(
     name = "llvm-size",
     srcs = glob([
         "tools/llvm-size/*.cpp",
-        "tools/llvm-size/*.h",
     ]) + ["llvm-size-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4698,7 +4641,6 @@ cc_binary(
     name = "llvm-split",
     srcs = glob([
         "tools/llvm-split/*.cpp",
-        "tools/llvm-split/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4728,7 +4670,6 @@ cc_binary(
     name = "llvm-strings",
     srcs = glob([
         "tools/llvm-strings/*.cpp",
-        "tools/llvm-strings/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4765,7 +4706,6 @@ cc_binary(
     name = "llvm-symbolizer",
     srcs = glob([
         "tools/llvm-symbolizer/*.cpp",
-        "tools/llvm-symbolizer/*.h",
     ]) + ["llvm-symbolizer-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4791,7 +4731,6 @@ cc_binary(
     name = "llvm-undname",
     srcs = glob([
         "tools/llvm-undname/*.cpp",
-        "tools/llvm-undname/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4805,7 +4744,6 @@ cc_binary(
     name = "llvm-xray",
     srcs = glob([
         "tools/llvm-xray/*.cpp",
-        "tools/llvm-xray/*.cc",
         "tools/llvm-xray/*.h",
     ]),
     copts = llvm_copts,
@@ -4888,7 +4826,6 @@ cc_binary(
     name = "sancov",
     srcs = glob([
         "tools/sancov/*.cpp",
-        "tools/sancov/*.h",
     ]) + ["sancov-driver.cpp"],
     copts = llvm_copts,
     stamp = 0,
@@ -4911,7 +4848,6 @@ cc_binary(
     name = "sanstats",
     srcs = glob([
         "tools/sanstats/*.cpp",
-        "tools/sanstats/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -4926,7 +4862,6 @@ cc_binary(
     name = "split-file",
     srcs = glob([
         "utils/split-file/*.cpp",
-        "utils/split-file/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5022,7 +4957,6 @@ cc_library(
     testonly = True,
     srcs = glob([
         "lib/Testing/Support/*.cpp",
-        "lib/Testing/Support/*.h",
     ]),
     hdrs = glob(["include/llvm/Testing/Support/*.h"]),
     copts = llvm_copts,
@@ -5051,7 +4985,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "utils/FileCheck/*.cpp",
-        "utils/FileCheck/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5097,7 +5030,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "utils/count/*.c",
-        "utils/count/*.h",
     ]),
     stamp = 0,
     deps = [":Support"],
@@ -5108,7 +5040,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "tools/lli/ChildTarget/*.cpp",
-        "tools/lli/ChildTarget/*.h",
     ]),
     copts = llvm_copts,
     # The tests load code into this binary that expect to see symbols
@@ -5175,7 +5106,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "tools/llvm-diff/*.cpp",
-        "tools/llvm-diff/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5193,7 +5123,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "tools/llvm-isel-fuzzer/*.cpp",
-        "tools/llvm-isel-fuzzer/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5239,7 +5168,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "utils/not/*.cpp",
-        "utils/not/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5319,7 +5247,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "tools/llvm-tli-checker/*.cpp",
-        "tools/llvm-tli-checker/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5366,7 +5293,6 @@ cc_binary(
     name = "verify-uselistorder",
     srcs = glob([
         "tools/verify-uselistorder/*.cpp",
-        "tools/verify-uselistorder/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
@@ -5386,7 +5312,6 @@ cc_binary(
     testonly = True,
     srcs = glob([
         "tools/yaml2obj/*.cpp",
-        "tools/yaml2obj/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index ba3f60380d340f..fb2b9659509f32 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -325,9 +325,7 @@ cc_library(
         "lib/IR/*.cpp",
         "lib/IR/*.h",
         "lib/IR/PDL/*.cpp",
-        "lib/Bytecode/Reader/*.h",
         "lib/Bytecode/Writer/*.h",
-        "lib/Bytecode/*.h",
     ]) + [
         "include/mlir/IR/PDLPatternMatch.h.inc",
         "lib/Bytecode/BytecodeOpInterface.cpp",
@@ -1627,7 +1625,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/AMDGPU/Transforms/*.cpp",
-            "lib/Dialect/AMDGPU/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/AMDGPU/Transforms/*.h"]),
@@ -1765,7 +1762,6 @@ cc_library(
     name = "TargetCpp",
     srcs = glob([
         "lib/Target/Cpp/*.cpp",
-        "lib/Target/Cpp/*.h",
     ]),
     hdrs = glob(["include/mlir/Target/Cpp/*.h"]),
     deps = [
@@ -1964,7 +1960,6 @@ cc_library(
     name = "ArmNeon2dToIntr",
     srcs = glob([
         "lib/Conversion/ArmNeon2dToIntr/*.cpp",
-        "lib/Conversion/ArmNeon2dToIntr/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ArmNeon2dToIntr/*.h",
@@ -2836,7 +2831,6 @@ cc_library(
     name = "SCFTransforms",
     srcs = glob([
         "lib/Dialect/SCF/Transforms/*.cpp",
-        "lib/Dialect/SCF/Transforms/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/SCF/Transforms/*.h",
@@ -3182,7 +3176,6 @@ cc_library(
     name = "SparseTensorTransforms",
     srcs = glob([
         "lib/Dialect/SparseTensor/Transforms/*.cpp",
-        "lib/Dialect/SparseTensor/Transforms/*.h",
         "lib/Dialect/SparseTensor/Transforms/Utils/*.cpp",
         "lib/Dialect/SparseTensor/Transforms/Utils/*.h",
     ]),
@@ -3820,7 +3813,6 @@ cc_library(
     name = "Dialect",
     srcs = glob([
         "lib/Dialect/*.cpp",
-        "lib/Dialect/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/*.h",
@@ -3862,7 +3854,6 @@ cc_library(
     name = "DialectUtils",
     srcs = glob([
         "lib/Dialect/Utils/*.cpp",
-        "lib/Dialect/Utils/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/Utils/*.h",
@@ -3881,7 +3872,6 @@ cc_library(
     name = "AffineDialect",
     srcs = glob([
         "lib/Dialect/Affine/IR/*.cpp",
-        "lib/Dialect/Affine/IR/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/Affine/IR/*.h",
@@ -4003,7 +3993,6 @@ cc_library(
     name = "AffineAnalysis",
     srcs = glob([
         "lib/Dialect/Affine/Analysis/*.cpp",
-        "lib/Dialect/Affine/Analysis/*.h",
     ]),
     hdrs = glob(["include/mlir/Dialect/Affine/Analysis/*.h"]),
     includes = ["include"],
@@ -4026,7 +4015,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Affine/Utils/*.cpp",
-            "lib/Dialect/Affine/Utils/*.h",
         ],
     ),
     hdrs = [
@@ -4073,7 +4061,6 @@ cc_library(
     name = "AffineTransforms",
     srcs = glob([
         "lib/Dialect/Affine/Transforms/*.cpp",
-        "lib/Dialect/Affine/Transforms/*.h",
     ]),
     hdrs = [
         "include/mlir/Dialect/Affine/Passes.h",
@@ -4179,7 +4166,6 @@ cc_library(
         ":MemRefToSPIRV",
         ":NVGPUToNVVM",
         ":NVVMToLLVM",
-        ":OpenACCToLLVM",
         ":OpenACCToSCF",
         ":OpenMPToLLVM",
         ":PDLToPDLInterp",
@@ -4212,7 +4198,6 @@ cc_library(
     name = "AsyncToLLVM",
     srcs = glob([
         "lib/Conversion/AsyncToLLVM/*.cpp",
-        "lib/Conversion/AsyncToLLVM/*.h",
     ]),
     hdrs = glob(["include/mlir/Conversion/AsyncToLLVM/*.h"]),
     includes = ["include"],
@@ -4238,7 +4223,6 @@ cc_library(
     name = "AffineToStandard",
     srcs = glob([
         "lib/Conversion/AffineToStandard/*.cpp",
-        "lib/Conversion/AffineToStandard/*.h",
     ]),
     hdrs = glob(["include/mlir/Conversion/AffineToStandard/*.h"]),
     includes = ["include"],
@@ -4259,32 +4243,11 @@ cc_library(
     ],
 )
 
-# SDBM dialect only contains attribute components that can be constructed given
-# a dialect object, so whenever it is used it must also be registered. Therefore
-# we don't split out the registration library for it.
-cc_library(
-    name = "SDBM",
-    srcs = glob([
-        "lib/Dialect/SDBM/*.cpp",
-        "lib/Dialect/SDBM/*.h",
-    ]),
-    hdrs = glob([
-        "include/mlir/Dialect/SDBM/*.h",
-    ]),
-    includes = ["include"],
-    deps = [
-        ":IR",
-        ":Support",
-        "//llvm:Support",
-    ],
-)
-
 cc_library(
     name = "SCFDialect",
     srcs = glob(
         [
             "lib/Dialect/SCF/IR/*.cpp",
-            "lib/Dialect/SCF/IR/*.h",
         ],
     ),
     hdrs = glob(
@@ -4593,7 +4556,6 @@ cc_library(
     name = "ShapeToStandard",
     srcs = glob([
         "lib/Conversion/ShapeToStandard/*.cpp",
-        "lib/Conversion/ShapeToStandard/*.h",
     ]),
     hdrs = ["include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h"],
     includes = ["include"],
@@ -4633,7 +4595,6 @@ cc_library(
     name = "ShapeTransforms",
     srcs = glob([
         "lib/Dialect/Shape/Transforms/*.cpp",
-        "lib/Dialect/Shape/Transforms/*.h",
     ]),
     hdrs = [
         "include/mlir/Dialect/Shape/Analysis/ShapeMappingAnalysis.h",
@@ -4716,7 +4677,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/ControlFlow/IR/*.cpp",
-            "lib/Dialect/ControlFlow/IR/*.h",
         ],
     ),
     hdrs = glob([
@@ -4762,13 +4722,10 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Func/IR/*.cpp",
-            "lib/Dialect/Func/IR/*.h",
-            "lib/Dialect/Func/Utils/*.cpp",
         ],
     ),
     hdrs = glob([
         "include/mlir/Dialect/Func/IR/*.h",
-        "include/mlir/Dialect/Func/Utils/*.h",
     ]),
     includes = ["include"],
     deps = [
@@ -4918,7 +4875,6 @@ cc_library(
     name = "FuncTransforms",
     srcs = glob([
         "lib/Dialect/Func/Transforms/*.cpp",
-        "lib/Dialect/Func/Transforms/*.h",
     ]),
     hdrs = glob(["include/mlir/Dialect/Func/Transforms/*.h"]),
     includes = ["include"],
@@ -5054,7 +5010,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Vector/Transforms/*.cpp",
-            "lib/Dialect/Vector/Transforms/*.h",
         ],
     ),
     hdrs = glob([
@@ -5121,7 +5076,6 @@ cc_library(
     name = "Support",
     srcs = glob([
         "lib/Support/*.cpp",
-        "lib/Support/*.h",
     ]),
     hdrs = glob(["include/mlir/Support/*.h"]),
     includes = ["include"],
@@ -5135,11 +5089,8 @@ cc_library(
     name = "Debug",
     srcs = glob([
         "lib/Debug/*.cpp",
-        "lib/Debug/*.h",
         "lib/Debug/BreakpointManagers/*.cpp",
-        "lib/Debug/BreakpointManagers/*.h",
         "lib/Debug/Observers/*.cpp",
-        "lib/Debug/Observers/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Debug/*.h",
@@ -5181,8 +5132,6 @@ cc_library(
         [
             "lib/Tools/mlir-lsp-server/*.cpp",
             "lib/Tools/mlir-lsp-server/*.h",
-            "lib/Tools/mlir-lsp-server/lsp/*.cpp",
-            "lib/Tools/mlir-lsp-server/lsp/*.h",
         ],
     ),
     hdrs = glob(
@@ -5256,8 +5205,6 @@ cc_library(
     name = "BytecodeReader",
     srcs = glob([
         "lib/Bytecode/Reader/*.cpp",
-        "lib/Bytecode/Reader/*.h",
-        "lib/Bytecode/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Bytecode/*.h",
@@ -5277,7 +5224,6 @@ cc_library(
     srcs = glob([
         "lib/Bytecode/Writer/*.cpp",
         "lib/Bytecode/Writer/*.h",
-        "lib/Bytecode/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Bytecode/*.h",
@@ -5295,7 +5241,6 @@ cc_library(
     name = "Parser",
     srcs = glob([
         "lib/Parser/*.cpp",
-        "lib/Parser/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Parser/*.h",
@@ -5426,7 +5371,6 @@ cc_library(
     name = "LLVMIRTransforms",
     srcs = glob([
         "lib/Dialect/LLVMIR/Transforms/*.cpp",
-        "lib/Dialect/LLVMIR/Transforms/*.h",
     ]),
     hdrs = glob(["include/mlir/Dialect/LLVMIR/Transforms/*.h"]),
     includes = ["include"],
@@ -5579,7 +5523,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/GPU/IR/*.cpp",
-            "lib/Dialect/GPU/IR/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/GPU/IR/*.h"]),
@@ -5673,7 +5616,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/GPU/Transforms/*.cpp",
-            "lib/Dialect/GPU/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/GPU/Transforms/*.h"]),
@@ -5862,7 +5804,6 @@ cc_library(
     name = "GPUToNVVMTransforms",
     srcs = glob([
         "lib/Conversion/GPUToNVVM/*.cpp",
-        "lib/Conversion/GPUToNVVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/GPUToNVVM/*.h",
@@ -5898,7 +5839,6 @@ cc_library(
     name = "AMDGPUToROCDL",
     srcs = glob([
         "lib/Conversion/AMDGPUToROCDL/*.cpp",
-        "lib/Conversion/AMDGPUToROCDL/*.h",
     ]) + ["include/mlir/Conversion/GPUToROCDL/Runtimes.h"],
     hdrs = glob([
         "include/mlir/Conversion/AMDGPUToROCDL/*.h",
@@ -5923,7 +5863,6 @@ cc_library(
     name = "NVGPUToNVVM",
     srcs = glob([
         "lib/Conversion/NVGPUToNVVM/*.cpp",
-        "lib/Conversion/NVGPUToNVVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/NVGPUToNVVM/*.h",
@@ -5951,7 +5890,6 @@ cc_library(
     name = "VectorToSPIRV",
     srcs = glob([
         "lib/Conversion/VectorToSPIRV/*.cpp",
-        "lib/Conversion/VectorToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/VectorToSPIRV/*.h",
@@ -6080,7 +6018,6 @@ cc_library(
     name = "GPUToSPIRV",
     srcs = glob([
         "lib/Conversion/GPUToSPIRV/*.cpp",
-        "lib/Conversion/GPUToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/GPUToSPIRV/*.h",
@@ -6650,7 +6587,6 @@ cc_library(
     name = "PDLDialect",
     srcs = glob([
         "lib/Dialect/PDL/IR/*.cpp",
-        "lib/Dialect/PDL/IR/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/PDL/IR/*.h",
@@ -6725,7 +6661,6 @@ cc_library(
     name = "PDLInterpDialect",
     srcs = glob([
         "lib/Dialect/PDLInterp/IR/*.cpp",
-        "lib/Dialect/PDLInterp/IR/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/PDLInterp/IR/*.h",
@@ -7022,7 +6957,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/SPIRV/Transforms/*.cpp",
-            "lib/Dialect/SPIRV/Transforms/*.h",
         ],
         exclude = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"],
     ),
@@ -7061,7 +6995,6 @@ cc_library(
     name = "MathToSPIRV",
     srcs = glob([
         "lib/Conversion/MathToSPIRV/*.cpp",
-        "lib/Conversion/MathToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/MathToSPIRV/*.h",
@@ -7088,7 +7021,6 @@ cc_library(
     name = "FuncToEmitC",
     srcs = glob([
         "lib/Conversion/FuncToEmitC/*.cpp",
-        "lib/Conversion/FuncToEmitC/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/FuncToEmitC/*.h",
@@ -7114,7 +7046,6 @@ cc_library(
     name = "FuncToSPIRV",
     srcs = glob([
         "lib/Conversion/FuncToSPIRV/*.cpp",
-        "lib/Conversion/FuncToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/FuncToSPIRV/*.h",
@@ -7146,7 +7077,6 @@ cc_library(
     name = "TensorToLinalg",
     srcs = glob([
         "lib/Conversion/TensorToLinalg/*.cpp",
-        "lib/Conversion/TensorToLinalg/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TensorToLinalg/*.h",
@@ -7175,7 +7105,6 @@ cc_library(
     name = "TensorToSPIRV",
     srcs = glob([
         "lib/Conversion/TensorToSPIRV/*.cpp",
-        "lib/Conversion/TensorToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TensorToSPIRV/*.h",
@@ -7461,7 +7390,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Tensor/Transforms/*.cpp",
-            "lib/Dialect/Tensor/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/Tensor/Transforms/*.h"]),
@@ -7567,7 +7495,6 @@ cc_library(
     srcs = glob(
         include = [
             "lib/Transforms/Utils/*.cpp",
-            "lib/Transforms/Utils/*.h",
         ],
         exclude = ["lib/Transforms/Utils/InliningUtils.cpp"],
     ),
@@ -7905,7 +7832,6 @@ cc_library(
     name = "Transforms",
     srcs = glob([
         "lib/Transforms/*.cpp",
-        "lib/Transforms/*.h",
     ]),
     hdrs = glob(["include/mlir/Transforms/*.h"]),
     includes = ["include"],
@@ -7991,7 +7917,6 @@ cc_library(
     name = "SCFToSPIRV",
     srcs = glob([
         "lib/Conversion/SCFToSPIRV/*.cpp",
-        "lib/Conversion/SCFToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/SCFToSPIRV/*.h",
@@ -8264,7 +8189,6 @@ cc_library(
     name = "MemRefToSPIRV",
     srcs = glob([
         "lib/Conversion/MemRefToSPIRV/*.cpp",
-        "lib/Conversion/MemRefToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/MemRefToSPIRV/*.h",
@@ -8324,7 +8248,6 @@ cc_library(
     name = "ArithToArmSME",
     srcs = glob([
         "lib/Conversion/ArithToArmSME/*.cpp",
-        "lib/Conversion/ArithToArmSME/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ArithToArmSME/*.h",
@@ -8345,7 +8268,6 @@ cc_library(
     name = "ArithToEmitC",
     srcs = glob([
         "lib/Conversion/ArithToEmitC/*.cpp",
-        "lib/Conversion/ArithToEmitC/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ArithToEmitC/*.h",
@@ -8636,9 +8558,7 @@ cc_library(
     srcs = glob(
         [
             "lib/Analysis/*.cpp",
-            "lib/Analysis/*.h",
             "lib/Analysis/*/*.cpp",
-            "lib/Analysis/*/*.h",
         ],
     ),
     hdrs = glob(
@@ -8944,7 +8864,6 @@ cc_library(
         ":IR",
         ":LLVMDialect",
         ":OpenACCDialect",
-        ":OpenACCToLLVM",
         ":OpenMPCommon",
         ":Support",
         ":ToLLVMIRTranslation",
@@ -9309,7 +9228,6 @@ cc_library(
         ":SCFToGPU",
         ":SCFTransformOps",
         ":SCFTransforms",
-        ":SDBM",
         ":SPIRVDialect",
         ":SPIRVPassIncGen",
         ":SPIRVTarget",
@@ -9420,7 +9338,6 @@ cc_binary(
         "//mlir/test:TestTosaDialect",
         "//mlir/test:TestTransformDialect",
         "//mlir/test:TestTransforms",
-        "//mlir/test:TestTypeDialect",
         "//mlir/test:TestVector",
         "//mlir/test:TestVectorToSPIRV",
     ],
@@ -10038,7 +9955,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/OpenACC/IR/*.cpp",
-            "lib/Dialect/OpenACC/IR/*.h",
         ],
     ),
     hdrs = glob(
@@ -10092,7 +10008,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/OpenACC/Transforms/*.cpp",
-            "lib/Dialect/OpenACC/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/OpenACC/Transforms/*.h"]),
@@ -10256,7 +10171,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/OpenMP/IR/*.cpp",
-            "lib/Dialect/OpenMP/IR/*.h",
         ],
     ),
     hdrs = glob(
@@ -10292,7 +10206,6 @@ cc_library(
     name = "OpenACCToSCF",
     srcs = glob([
         "lib/Conversion/OpenACCToSCF/*.cpp",
-        "lib/Conversion/OpenACCToSCF/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/OpenACCToSCF/*.h",
@@ -10312,35 +10225,10 @@ cc_library(
     ],
 )
 
-cc_library(
-    name = "OpenACCToLLVM",
-    srcs = glob([
-        "lib/Conversion/OpenACCToLLVM/*.cpp",
-        "lib/Conversion/OpenACCToLLVM/*.h",
-    ]),
-    hdrs = glob([
-        "include/mlir/Conversion/OpenACCToLLVM/*.h",
-    ]),
-    includes = ["include"],
-    deps = [
-        ":ConversionPassIncGen",
-        ":FuncDialect",
-        ":IR",
-        ":LLVMCommonConversion",
-        ":LLVMDialect",
-        ":OpenACCDialect",
-        ":Pass",
-        ":Transforms",
-        "//llvm:Core",
-        "//llvm:Support",
-    ],
-)
-
 cc_library(
     name = "OpenMPToLLVM",
     srcs = glob([
         "lib/Conversion/OpenMPToLLVM/*.cpp",
-        "lib/Conversion/OpenMPToLLVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/OpenMPToLLVM/*.h",
@@ -10550,7 +10438,6 @@ cc_library(
     name = "IndexToLLVM",
     srcs = glob([
         "lib/Conversion/IndexToLLVM/*.cpp",
-        "lib/Conversion/IndexToLLVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/IndexToLLVM/*.h",
@@ -10576,7 +10463,6 @@ cc_library(
     name = "IndexToSPIRV",
     srcs = glob([
         "lib/Conversion/IndexToSPIRV/*.cpp",
-        "lib/Conversion/IndexToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/IndexToSPIRV/*.h",
@@ -10967,7 +10853,6 @@ cc_library(
     name = "LinalgToStandard",
     srcs = glob([
         "lib/Conversion/LinalgToStandard/*.cpp",
-        "lib/Conversion/LinalgToStandard/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/LinalgToStandard/*.h",
@@ -11112,7 +10997,6 @@ cc_library(
     name = "LinalgUtils",
     srcs = glob([
         "lib/Dialect/Linalg/Utils/*.cpp",
-        "lib/Dialect/Linalg/Utils/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/Linalg/Utils/*.h",
@@ -11141,7 +11025,6 @@ cc_library(
     name = "LinalgTransforms",
     srcs = glob([
         "lib/Dialect/Linalg/Transforms/*.cpp",
-        "lib/Dialect/Linalg/Transforms/*.h",
     ]),
     hdrs = [
         "include/mlir/Dialect/Linalg/Passes.h",
@@ -11493,7 +11376,6 @@ cc_library(
     name = "VectorToLLVM",
     srcs = glob([
         "lib/Conversion/VectorToLLVM/*.cpp",
-        "lib/Conversion/VectorToLLVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/VectorToLLVM/*.h",
@@ -11535,7 +11417,6 @@ cc_library(
     name = "VectorToArmSME",
     srcs = glob([
         "lib/Conversion/VectorToArmSME/*.cpp",
-        "lib/Conversion/VectorToArmSME/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/VectorToArmSME/*.h",
@@ -11556,7 +11437,6 @@ cc_library(
     name = "VectorToGPU",
     srcs = glob([
         "lib/Conversion/VectorToGPU/*.cpp",
-        "lib/Conversion/VectorToGPU/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/VectorToGPU/*.h",
@@ -11593,7 +11473,6 @@ cc_library(
     name = "VectorToSCF",
     srcs = glob([
         "lib/Conversion/VectorToSCF/*.cpp",
-        "lib/Conversion/VectorToSCF/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/VectorToSCF/*.h",
@@ -11743,7 +11622,6 @@ cc_library(
     name = "TosaDialect",
     srcs = glob([
         "lib/Dialect/Tosa/IR/*.cpp",
-        "lib/Dialect/Tosa/IR/*.h",
         "lib/Dialect/Tosa/Utils/*.cpp",
         "lib/Dialect/Tosa/Transforms/*.cpp",
     ]),
@@ -11783,7 +11661,6 @@ cc_library(
     name = "TosaToArith",
     srcs = glob([
         "lib/Conversion/TosaToArith/*.cpp",
-        "lib/Conversion/TosaToArith/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TosaToArith/*.h",
@@ -11807,7 +11684,6 @@ cc_library(
     name = "TosaToLinalg",
     srcs = glob([
         "lib/Conversion/TosaToLinalg/*.cpp",
-        "lib/Conversion/TosaToLinalg/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TosaToLinalg/*.h",
@@ -11840,7 +11716,6 @@ cc_library(
     name = "TosaToMLProgram",
     srcs = glob([
         "lib/Conversion/TosaToMLProgram/*.cpp",
-        "lib/Conversion/TosaToMLProgram/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TosaToMLProgram/*.h",
@@ -11864,7 +11739,6 @@ cc_library(
     name = "TosaToSCF",
     srcs = glob([
         "lib/Conversion/TosaToSCF/*.cpp",
-        "lib/Conversion/TosaToSCF/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TosaToSCF/*.h",
@@ -11889,7 +11763,6 @@ cc_library(
     name = "TosaToTensor",
     srcs = glob([
         "lib/Conversion/TosaToTensor/*.cpp",
-        "lib/Conversion/TosaToTensor/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/TosaToTensor/*.h",
@@ -12383,7 +12256,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Complex/IR/*.cpp",
-            "lib/Dialect/Complex/IR/*.h",
         ],
     ),
     hdrs = ["include/mlir/Dialect/Complex/IR/Complex.h"],
@@ -12406,7 +12278,6 @@ cc_library(
     name = "ComplexToLLVM",
     srcs = glob([
         "lib/Conversion/ComplexToLLVM/*.cpp",
-        "lib/Conversion/ComplexToLLVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ComplexToLLVM/*.h",
@@ -12434,7 +12305,6 @@ cc_library(
     name = "ComplexToLibm",
     srcs = glob([
         "lib/Conversion/ComplexToLibm/*.cpp",
-        "lib/Conversion/ComplexToLibm/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ComplexToLibm/*.h",
@@ -12458,7 +12328,6 @@ cc_library(
     name = "ComplexToSPIRV",
     srcs = glob([
         "lib/Conversion/ComplexToSPIRV/*.cpp",
-        "lib/Conversion/ComplexToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ComplexToSPIRV/*.h",
@@ -12483,7 +12352,6 @@ cc_library(
     name = "ComplexToStandard",
     srcs = glob([
         "lib/Conversion/ComplexToStandard/*.cpp",
-        "lib/Conversion/ComplexToStandard/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/ComplexToStandard/*.h",
@@ -12698,7 +12566,6 @@ cc_library(
     name = "ArithTransforms",
     srcs = glob([
         "lib/Dialect/Arith/Transforms/*.cpp",
-        "lib/Dialect/Arith/Transforms/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Dialect/Arith/Transforms/*.h",
@@ -12820,7 +12687,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Math/IR/*.cpp",
-            "lib/Dialect/Math/IR/*.h",
         ],
     ),
     hdrs = [
@@ -12847,7 +12713,6 @@ cc_library(
     name = "MathTransforms",
     srcs = glob([
         "lib/Dialect/Math/Transforms/*.cpp",
-        "lib/Dialect/Math/Transforms/*.h",
     ]),
     hdrs = glob(["include/mlir/Dialect/Math/Transforms/*.h"]),
     includes = ["include"],
@@ -12871,7 +12736,6 @@ cc_library(
     name = "MathToLibm",
     srcs = glob([
         "lib/Conversion/MathToLibm/*.cpp",
-        "lib/Conversion/MathToLibm/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/MathToLibm/*.h",
@@ -12962,7 +12826,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/MemRef/IR/*.cpp",
-            "lib/Dialect/MemRef/IR/*.h",
         ],
     ),
     hdrs = [
@@ -13038,7 +12901,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/MemRef/Transforms/*.cpp",
-            "lib/Dialect/MemRef/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/MemRef/Transforms/*.h"]),
@@ -13662,7 +13524,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Dialect/Bufferization/Transforms/*.cpp",
-            "lib/Dialect/Bufferization/Transforms/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Dialect/Bufferization/Transforms/*.h"]),
@@ -13854,7 +13715,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Tools/PDLL/ODS/*.cpp",
-            "lib/Tools/PDLL/ODS/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Tools/PDLL/ODS/*.h"]),
@@ -13888,7 +13748,6 @@ cc_library(
     srcs = glob(
         [
             "lib/Tools/PDLL/CodeGen/*.cpp",
-            "lib/Tools/PDLL/CodeGen/*.h",
         ],
     ),
     hdrs = glob(["include/mlir/Tools/PDLL/CodeGen/*.h"]),
@@ -14049,7 +13908,6 @@ cc_library(
     name = "UBToLLVM",
     srcs = glob([
         "lib/Conversion/UBToLLVM/*.cpp",
-        "lib/Conversion/UBToLLVM/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/UBToLLVM/*.h",
@@ -14070,7 +13928,6 @@ cc_library(
     name = "UBToSPIRV",
     srcs = glob([
         "lib/Conversion/UBToSPIRV/*.cpp",
-        "lib/Conversion/UBToSPIRV/*.h",
     ]),
     hdrs = glob([
         "include/mlir/Conversion/UBToSPIRV/*.h",
diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
index ccfef3f243409d..6a62bbd856295b 100644
--- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
@@ -812,7 +812,6 @@ cc_library(
 cc_library(
     name = "TestMesh",
     srcs = glob(["lib/Dialect/Mesh/**/*.cpp"]),
-    hdrs = glob(["lib/Dialect/Mesh/**/*.h"]),
     includes = ["lib/Dialect/Test"],
     deps = [
         ":TestDialect",
@@ -1039,18 +1038,6 @@ cc_library(
     ],
 )
 
-cc_library(
-    name = "TestTypeDialect",
-    srcs = glob([
-        "lib/Dialect/LLVMIR/*.cpp",
-    ]),
-    deps = [
-        ":TestDialect",
-        "//mlir:IR",
-        "//mlir:LLVMDialect",
-    ],
-)
-
 cc_library(
     name = "TestTosaDialect",
     srcs = glob([
diff --git a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
index 252b9ec951f6bd..2c750d26362a60 100644
--- a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
@@ -16,7 +16,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Debug/*.cpp",
-        "Debug/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -35,7 +34,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "IR/*.cpp",
-        "IR/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -56,7 +54,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Interfaces/*.cpp",
-        "Interfaces/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -81,7 +78,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Support/*.cpp",
-        "Support/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -97,7 +93,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Pass/*.cpp",
-        "Pass/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -117,7 +112,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Rewrite/*.cpp",
-        "Rewrite/*.h",
     ]),
     deps = [
         "//mlir:IR",
@@ -133,7 +127,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/*.cpp",
-        "Dialect/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -148,7 +141,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/MemRef/*.cpp",
-        "Dialect/MemRef/*.h",
     ]),
     deps = [
         "//llvm:TestingSupport",
@@ -160,27 +152,11 @@ cc_test(
     ],
 )
 
-cc_test(
-    name = "quantops_tests",
-    size = "small",
-    srcs = glob([
-        "Dialect/Quant/*.cpp",
-        "Dialect/Quant/*.h",
-    ]),
-    deps = [
-        "//llvm:TestingSupport",
-        "//mlir:QuantOps",
-        "//mlir:Transforms",
-        "//third-party/unittest:gtest_main",
-    ],
-)
-
 cc_test(
     name = "scf_tests",
     size = "small",
     srcs = glob([
         "Dialect/SCF/*.cpp",
-        "Dialect/SCF/*.h",
     ]),
     deps = [
         "//mlir:ArithDialect",
@@ -199,7 +175,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/SparseTensor/*.cpp",
-        "Dialect/SparseTensor/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -217,7 +192,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/SPIRV/*.cpp",
-        "Dialect/SPIRV/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -237,7 +211,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/Transform/*.cpp",
-        "Dialect/Transform/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -263,7 +236,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Dialect/Utils/*.cpp",
-        "Dialect/Utils/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -316,7 +288,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "TableGen/*.cpp",
-        "TableGen/*.h",
     ]) + [
         "TableGen/EnumsGenTest.cpp.inc",
         "TableGen/EnumsGenTest.h.inc",
@@ -342,7 +313,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Transforms/*.cpp",
-        "Transforms/*.h",
     ]),
     deps = [
         "//mlir:AffineAnalysis",
@@ -362,8 +332,6 @@ cc_test(
     name = "analysis_tests",
     size = "small",
     srcs = glob([
-        "Analysis/*.cpp",
-        "Analysis/*.h",
         "Analysis/*/*.cpp",
         "Analysis/*/*.h",
     ]),
@@ -386,9 +354,6 @@ cc_test(
     size = "small",
     srcs = glob([
         "Bytecode/*.cpp",
-        "Bytecode/*.h",
-        "Bytecode/*/*.cpp",
-        "Bytecode/*/*.h",
     ]),
     deps = [
         "//llvm:Support",
@@ -407,10 +372,7 @@ cc_test(
     name = "conversion_tests",
     size = "small",
     srcs = glob([
-        "Conversion/*.cpp",
-        "Conversion/*.h",
         "Conversion/*/*.cpp",
-        "Conversion/*/*.h",
     ]),
     deps = [
         "//mlir:ArithDialect",



More information about the llvm-commits mailing list