[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #131421)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 19:35:20 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/131421

None

>From d47557a10b36f6b6192672c8d872668303dde94c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 14 Mar 2025 07:25:20 -0700
Subject: [PATCH] [Analysis] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Analysis/LoopAccessAnalysis.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 38ee82b77a946..57a76bc7a81e5 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2287,8 +2287,9 @@ bool MemoryDepChecker::areDepsSafe(const DepCandidates &AccessSets,
           (AIIsWrite ? AI : std::next(AI));
       while (OI != AE) {
         // Check every accessing instruction pair in program order.
-        for (std::vector<unsigned>::iterator I1 = Accesses[*AI].begin(),
-             I1E = Accesses[*AI].end(); I1 != I1E; ++I1)
+        auto &Acc = Accesses[*AI];
+        for (std::vector<unsigned>::iterator I1 = Acc.begin(), I1E = Acc.end();
+             I1 != I1E; ++I1)
           // Scan all accesses of another equivalence class, but only the next
           // accesses of the same equivalent class.
           for (std::vector<unsigned>::iterator



More information about the llvm-commits mailing list