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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-hexagon

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp (+1-2) 


``````````diff
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;
 }

``````````

</details>


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


More information about the llvm-commits mailing list