[all-commits] [llvm/llvm-project] 0c6784: [MemDep] Optimize SortNonLocalDepInfoCache sorting...

DingdWang via All-commits all-commits at lists.llvm.org
Fri Jul 25 07:45:23 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c6784c9514d0ddb257bf0fd797969e0ae602882
      https://github.com/llvm/llvm-project/commit/0c6784c9514d0ddb257bf0fd797969e0ae602882
  Author: DingdWang <wdd12358 at gmail.com>
  Date:   2025-07-25 (Fri, 25 Jul 2025)

  Changed paths:
    M llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

  Log Message:
  -----------
  [MemDep] Optimize SortNonLocalDepInfoCache sorting strategy for large caches with few unsorted entries (#143107)

During compilation of large files with many branches, I observed that
the function `SortNonLocalDepInfoCache` in `MemoryDependenceAnalysis`
becomes a significant performance bottleneck. This is because
`Cache.size()` can be very large (around 20,000), but only a small
number of entries (approximately 5 to 8) actually need sorting. The
original implementation performs a full sort in all cases, which is
inefficient.

This patch introduces a lightweight heuristic to quickly estimate the
number of unsorted entries and choose a more efficient sorting method
accordingly.

As a result, the GVN pass runtime on a large file is reduced from
approximately 26.3 minutes to 16.5 minutes.



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