[all-commits] [llvm/llvm-project] 5312c6: [flang][AliasAnalysis] Add opt-in getSource memoiz...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed Jul 8 13:38:29 PDT 2026


  Branch: refs/heads/users/vzakhari/fir-aa-source-cache
  Home:   https://github.com/llvm/llvm-project
  Commit: 5312c6ec6cc296478b10cff7a92ea3bd8c2241c8
      https://github.com/llvm/llvm-project/commit/5312c6ec6cc296478b10cff7a92ea3bd8c2241c8
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2026-07-08 (Wed, 08 Jul 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Analysis/AliasAnalysis.h
    M flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
    M flang/lib/Optimizer/Transforms/LoopInvariantCodeMotion.cpp
    A flang/unittests/Optimizer/AliasAnalysisCacheTest.cpp
    M flang/unittests/Optimizer/CMakeLists.txt

  Log Message:
  -----------
  [flang][AliasAnalysis] Add opt-in getSource memoization cache

Add an opt-in cache to fir::AliasAnalysis that memoizes getSource()
results keyed on (value, flags). Caching is off by default and turned on
via enableSourceCache(); getSource() becomes a thin wrapper over the
uncached getSourceImpl(). The cache is a frozen snapshot with no
automatic invalidation and lives no longer than the AliasAnalysis
instance, so a client enables it only for a region in which it does not
mutate IR in a way that would change a source.

Flang's LICM enables the cache on its fir::AliasAnalysis before adding it
to the mlir::AliasAnalysis aggregate: LICM only moves operations, so
getSource()'s inputs are unchanged across the hoists, and the pass
manager drops the analysis (and its cache) after the pass.

Add a unit test covering the default-off behavior, cache fill/hit, and
that disableSourceCache() clears and bypasses the cache.

Assisted by Cursor



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