[all-commits] [llvm/llvm-project] c72e55: [MLIR][CMake] Add PCH for MLIRIR

Maksim Levental via All-commits all-commits at lists.llvm.org
Fri Jul 31 22:56:50 PDT 2026


  Branch: refs/heads/users/makslevental/mlir-ir-pch
  Home:   https://github.com/llvm/llvm-project
  Commit: c72e559157248b271439ac1ebca6187634922328
      https://github.com/llvm/llvm-project/commit/c72e559157248b271439ac1ebca6187634922328
  Author: makslevental <maksim.levental at gmail.com>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    A mlir/include/mlir/IR/pch.h
    M mlir/lib/CMakeLists.txt
    M mlir/lib/IR/CMakeLists.txt
    M mlir/lib/Tools/mlir-lsp-server/LSPServer.cpp

  Log Message:
  -----------
  [MLIR][CMake] Add PCH for MLIRIR

Add a precompiled header for MLIRIR, following the infrastructure added in
llvm#176420 and the per-component PCHs for llvm/IR (llvm#183303),
llvm/CodeGen (llvm#183346) and clang/AST (llvm#183358).

The header list was selected with the same methodology: compile all 1173
CUs under mlir/lib with -ftime-trace, rank mlir headers by the time spent
parsing them (including transitively included headers), then greedily pick
the header with the largest marginal coverage until the marginal gain
falls off. Candidates were restricted to headers already reachable from
MLIRIR's own sources, so the PCH does not invert the library layering.

Over the mlir/lib CUs, the selected set covers 1227s of 3674s total
frontend time (33%). On a Release+assertions build of mlir-opt
(Apple M-series, -j16), clean build wall time goes from 468.3s to 440.8s
(-5.9%); 715 of 1536 MLIR objects reuse the PCH.

mlir/lib/CMakeLists.txt gains an explicit add_subdirectory(IR) before the
other directories: CMake can only reuse a PCH from a target that is
already defined, so MLIRIR must exist before its dependants.

As with the earlier PCHs, the wider header visibility exposes a name
collision: mlir-lsp-server/LSPServer.cpp does `using namespace mlir` and
`using llvm::lsp::Location`, which becomes ambiguous once mlir::Location
is declared. Qualify the llvm::lsp::Location uses in that file.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list