[all-commits] [llvm/llvm-project] 43b287: Cache DeclContext-to-Decl conversions

Mehdi Amini via All-commits all-commits at lists.llvm.org
Tue Sep 15 09:06:44 PDT 2026


  Branch: refs/heads/users/mamini/clang-speed-declcontext-decl-cache
  Home:   https://github.com/llvm/llvm-project
  Commit: 43b287ed466b03ad9a273e005d07bc344a6e1076
      https://github.com/llvm/llvm-project/commit/43b287ed466b03ad9a273e005d07bc344a6e1076
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/AST/DeclCXX.h
    M clang/include/clang/AST/DeclOpenMP.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/AST/DeclCXX.cpp
    M clang/lib/AST/DeclObjC.cpp
    M clang/lib/AST/DeclOpenMP.cpp
    M clang/lib/AST/DeclTemplate.cpp

  Log Message:
  -----------
  Cache DeclContext-to-Decl conversions

Store the owning Decl pointer when constructing each DeclContext and route
parent traversal and generic casts through it. This avoids a lazy lookup and
does not imply support for concurrent AST traversal.

CTMark O0 (three alternating matched-build samples, CPU 6): 28.990700 s ->
28.702600 s (-0.9938%). Peak build RSS: 258016 -> 259276 KiB (+0.4883%).
All 632 normalized objects matched in each pair.

MLIR build-time medians (three alternating matched-build samples, CPU 6):
- `mlir/lib/RegisterAllDialects.cpp`: 2.8115% fewer retired instructions,
  0.7353% less user CPU, 0.1972% less wall time, and 7144 KiB (+0.5257%)
  peak RSS.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.5841% fewer retired
  instructions, 1.1120% less user CPU, 0.9893% less wall time, and 912 KiB
  (+0.0795%) peak RSS.

All MLIR outputs matched after removing only `.comment`; each concurrency
guard log was empty.

Assisted-by: Codex



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