[llvm] [MemDep] Optimize SortNonLocalDepInfoCache sorting strategy for large caches with few unsorted entries (PR #143107)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 03:52:23 PDT 2025
================
@@ -983,33 +983,41 @@ MemDepResult MemoryDependenceResults::getNonLocalInfoForBlock(
static void
SortNonLocalDepInfoCache(MemoryDependenceResults::NonLocalDepInfo &Cache,
unsigned NumSortedEntries) {
- switch (Cache.size() - NumSortedEntries) {
- case 0:
- // done, no new entries.
- break;
- case 2: {
- // Two new entries, insert the last one into place.
- NonLocalDepEntry Val = Cache.back();
- Cache.pop_back();
- MemoryDependenceResults::NonLocalDepInfo::iterator Entry =
- std::upper_bound(Cache.begin(), Cache.end() - 1, Val);
- Cache.insert(Entry, Val);
- [[fallthrough]];
+
+ // Output number of sorted entries and size of cache for each sort.
+ LLVM_DEBUG(dbgs() << "NumSortedEntries: " << NumSortedEntries
+ << ", Cache.size: " << Cache.size() << "\n");
----------------
DingdWang wrote:
done
https://github.com/llvm/llvm-project/pull/143107
More information about the llvm-commits
mailing list