[llvm] [Hexagon] Avoid repeated map lookups (NFC) (PR #125815)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 23:20:04 PST 2025


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

None

>From 3cd0a8f9bba8964516e9a90c97ddb329d2445e4c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 4 Feb 2025 22:56:15 -0800
Subject: [PATCH] [Hexagon] Avoid repeated map lookups (NFC)

---
 llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
index cfb552c65e0c6f..a1956092efbdee 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
@@ -262,8 +262,7 @@ bool Coloring::color() {
 
   // Explicitly assign "None" to all uncolored nodes.
   for (unsigned I = 0; I != Order.size(); ++I)
-    if (Colors.count(I) == 0)
-      Colors[I] = ColorKind::None;
+    Colors.try_emplace(I, ColorKind::None);
 
   return true;
 }



More information about the llvm-commits mailing list