[llvm] 23a26e7 - [DFAJumpThreading] Avoid repeated hash lookups (NFC) (#107670)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 7 08:22:24 PDT 2024


Author: Kazu Hirata
Date: 2024-09-07T08:22:21-07:00
New Revision: 23a26e7120df474f37f7369e8e06fd90f21a58b5

URL: https://github.com/llvm/llvm-project/commit/23a26e7120df474f37f7369e8e06fd90f21a58b5
DIFF: https://github.com/llvm/llvm-project/commit/23a26e7120df474f37f7369e8e06fd90f21a58b5.diff

LOG: [DFAJumpThreading] Avoid repeated hash lookups (NFC) (#107670)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 58f06ca8b0297b..ef9c264482a640 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -502,10 +502,8 @@ struct MainSwitch {
   void addToQueue(Value *Val, BasicBlock *BB,
                   std::deque<std::pair<Value *, BasicBlock *>> &Q,
                   SmallSet<Value *, 16> &SeenValues) {
-    if (SeenValues.contains(Val))
-      return;
-    Q.push_back({Val, BB});
-    SeenValues.insert(Val);
+    if (SeenValues.insert(Val).second)
+      Q.push_back({Val, BB});
   }
 
   bool isValidSelectInst(SelectInst *SI) {


        


More information about the llvm-commits mailing list