[llvm] [Utils] Avoid repeated hash lookups (NFC) (PR #131723)

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


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

None

>From 7931b91712507657cb2618d4bca5ef9ff44ffb35 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 17 Mar 2025 09:06:10 -0700
Subject: [PATCH] [Utils] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Transforms/Utils/SCCPSolver.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index 81aa7ce1cfe66..c64254140cf22 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -1485,10 +1485,11 @@ void SCCPInstVisitor::visitSelectInst(SelectInst &I) {
   ValueLatticeElement TVal = getValueState(I.getTrueValue());
   ValueLatticeElement FVal = getValueState(I.getFalseValue());
 
-  bool Changed = ValueState[&I].mergeIn(TVal);
-  Changed |= ValueState[&I].mergeIn(FVal);
+  ValueLatticeElement &State = ValueState[&I];
+  bool Changed = State.mergeIn(TVal);
+  Changed |= State.mergeIn(FVal);
   if (Changed)
-    pushToWorkListMsg(ValueState[&I], &I);
+    pushToWorkListMsg(State, &I);
 }
 
 // Handle Unary Operators.



More information about the llvm-commits mailing list