[all-commits] [llvm/llvm-project] 844da7: Cache DeclContext-to-Decl conversions

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Sep 11 01:39:53 PDT 2026


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

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/lib/AST/DeclBase.cpp

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

Cache the corresponding Decl pointer after the first DeclContext conversion
and route parent traversal and generic casts through the cache. Use relaxed
atomic access so concurrent read-only AST traversal remains race-free.

CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.303500 s (-0.463%).

Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 2.5437% fewer retired
  instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 1.3250% fewer retired
  instructions.

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