[llvm] [Support] Avoid repeated hash lookups (NFC) (PR #129827)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 4 20:51:32 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/lib/Support/BalancedPartitioning.cpp (+2-1) 


``````````diff
diff --git a/llvm/lib/Support/BalancedPartitioning.cpp b/llvm/lib/Support/BalancedPartitioning.cpp
index 7b807b167c0ef..ed3b149c03daf 100644
--- a/llvm/lib/Support/BalancedPartitioning.cpp
+++ b/llvm/lib/Support/BalancedPartitioning.cpp
@@ -177,7 +177,8 @@ void BalancedPartitioning::runIterations(const FunctionNodeRange Nodes,
   // functions
   for (auto &N : Nodes)
     llvm::erase_if(N.UtilityNodes, [&](auto &UN) {
-      return UtilityNodeIndex[UN] == 1 || UtilityNodeIndex[UN] == NumNodes;
+      unsigned UNI = UtilityNodeIndex[UN];
+      return UNI == 1 || UNI == NumNodes;
     });
 
   // Renumber utility nodes so they can be used to index into Signatures

``````````

</details>


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


More information about the llvm-commits mailing list