[llvm] [DFAJumpThreading] Avoid repeated hash lookups (NFC) (PR #107670)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 23:47:43 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107670
None
>From 2e6321a4c819029937382754a2d5d02835e600ff Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 6 Sep 2024 23:43:47 -0700
Subject: [PATCH] [DFAJumpThreading] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
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