[llvm] [Hexagon] Avoid repeated hash lookups (NFC) (PR #131719)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 20:56:29 PDT 2025


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

None

>From 1b660ca5043ffaa1a39868bf15779d0e25e2eaa9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 17 Mar 2025 15:37:40 -0700
Subject: [PATCH] [Hexagon] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
index 4bb1b1eb22eba..53943de3bc597 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
@@ -2437,10 +2437,7 @@ void HexagonDAGToDAGISel::rebalanceAddressTrees() {
         continue;
 
       // This root node has already been processed
-      if (RootWeights.count(N))
-        continue;
-
-      RootWeights[N] = -1;
+      RootWeights.try_emplace(N, -1);
     }
 
     // Balance node itself



More information about the llvm-commits mailing list