[all-commits] [llvm/llvm-project] 2a1098: Cache DeclContext-to-Decl conversions

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Sep 11 12:37:57 PDT 2026


  Branch: refs/heads/users/mamini/clang-speed-declcontext-decl-cache
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a109893ce3f5970a9c618b8845eb4d158b3c6e6
      https://github.com/llvm/llvm-project/commit/2a109893ce3f5970a9c618b8845eb4d158b3c6e6
  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