[llvm] [ARM] Avoid repeated hash lookups (NFC) (PR #109602)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 21:06:50 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/109602.diff


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp (+1-2) 


``````````diff
diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
index a4598de96fa3b4..e7dfbfb64fa521 100644
--- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
+++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
@@ -144,10 +144,9 @@ namespace {
     void ProcessLoop() {
       std::function<void(MachineBasicBlock *)> Search =
           [this, &Search](MachineBasicBlock *MBB) -> void {
-        if (Visited.count(MBB))
+        if (!Visited.insert(MBB).second)
           return;
 
-        Visited.insert(MBB);
         for (auto *Succ : MBB->successors()) {
           if (!ML.contains(Succ))
             continue;

``````````

</details>


https://github.com/llvm/llvm-project/pull/109602


More information about the llvm-commits mailing list