[all-commits] [llvm/llvm-project] 681927: [LifetimeSafety] Cache lifetimebound macro lookup ...

Zeyi Xu via All-commits all-commits at lists.llvm.org
Wed Jun 24 08:40:38 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 68192737824cd28410a4c02affde86971b8cb10d
      https://github.com/llvm/llvm-project/commit/68192737824cd28410a4c02affde86971b8cb10d
  Author: Zeyi Xu <mitchell.xu2 at gmail.com>
  Date:   2026-06-24 (Wed, 24 Jun 2026)

  Changed paths:
    M clang/lib/Sema/SemaLifetimeSafety.h
    M clang/test/Sema/LifetimeSafety/annotation-suggestions-fixits.cpp

  Log Message:
  -----------
  [LifetimeSafety] Cache lifetimebound macro lookup (#205250)

Cache lifetimebound macro spelling lookup used by fix-it suggestions.

Current cache strategy:

- During cache build, collect macro names that have ever been defined as
a lifetimebound attribute spelling.
- During lookup, only visit those cached macro names, find the active
definition at the fix-it location, and re-check that the active
definition still has lifetimebound spelling.
- If multiple matching macros are active at the fix-it location, use the
most recently defined one.

Performance:

| Case | Before 359bfe6 | 359bfe6| After Cached |

|-------------------------------------------------------------|----------------:|---------------:|-------------:|
| C++ no diagnostics (8k macros, 5k safe functions) | 42.5 ms | 44.2 ms
| 47.0 ms |
| C++ 10 diagnostics, 8k macros | 23.2 ms | 23.4 ms | 17.5 ms |
| C++ 200 diagnostics, macro passed via command line option | 24.8 ms |
24.6 ms | 29.3 ms |
| C++ 200 diagnostics, 8k macros | 26.3 ms | 41.7 ms | 27.9 ms |
| C++ stress: 1000 diagnostics, 20k macros, no matching macro
(simulating worst case scenario) | 40.8 ms | 386.7 ms | 78.9 ms |

AI Usage: Performance experiment assisted by Codex.
Follow up of https://github.com/llvm/llvm-project/pull/204045



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