[Mlir-commits] [mlir] [MLIR][CMake] Add PCH for MLIRIR (PR #213412)
Alexis Engelke
llvmlistbot at llvm.org
Sat Aug 1 03:07:33 PDT 2026
aengelke wrote:
> In Release the frontend is a much smaller share of total compile time and optimization dominates
Release (AMD Zen 4, 48 cores, -j46) (-O3) build with Clang 23 -- for the files in tools/mlir/, the frontend takes 75% of the time, 55% of the time spent in parsing headers (Source):
```
(7274183749, 1368, 'ExecuteCompiler')
(5496136136, 2736, 'Frontend')
(3975591717, 7049, 'Source')
(1218552332, 1368, 'PerformPendingInstantiations')
(166794938, 3577962, 'CodeGen Function')
(1718719825, 1368, 'Backend')
(1145578477, 1368, 'Optimizer')
(564929029, 1368, 'CodeGenPasses')
```
Also, some notable expensive template instantiations (just instantiation time, no codegen/opt/backend) (read: total microseconds of Instantiate, number of instantiations, name):
```
[41339256, 1244] llvm::MapVector<mlir::TypeID, std::unique_ptr<mlir::DialectExtensionBase>>::try_emplace<std::unique_ptr<mlir::DialectExtensionBase>>
[19808050, 2182] llvm::DenseMap<mlir::Operation *, std::unique_ptr<mlir::SymbolTable>>::DenseMap
[19290419, 1] mlir::Dialect::addOperations<mlir::spirv::..........>
[13891130, 1] registerAll<mlir::linalg::.........>
[12658932, 3645] llvm::TrailingObjects<mlir::Operation, mlir::detail::OperandStorage, mlir::detail::OpProperties, mlir::BlockOperand, mlir::Region, mlir::OpOperand>::getTrailingObjects<mlir::Region>
[10220718, 1242] std::vector<std::function<mlir::WalkResult (mlir::Attribute)>>::emplace_back<std::function<mlir::WalkResult (mlir::Attribute)>>
[10061813, 1237] llvm::map_to_vector<4U, llvm::ArrayRef<mlir::AffineExpr>, (lambda at /home/engelke/llvm-project/mlir/include/mlir/IR/AffineMap.h:272:31)>
```
IME, Apple clang is quite a bit slower than upstream Clang, both in general compilation and w.r.t. PCH. I never bothered to investigate (also somewhat difficult...), just built my own Clang. Maybe you can try upstream Clang.
https://github.com/llvm/llvm-project/pull/213412
More information about the Mlir-commits
mailing list