Skip to content

Commit 7928e14

Browse files
[BOLT] Avoid repeated map lookups (NFC) (#112118)
1 parent 464a7ee commit 7928e14

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,9 +3684,8 @@ BinaryFunction::BasicBlockListType BinaryFunction::dfs() const {
36843684
BinaryBasicBlock *BB = Stack.top();
36853685
Stack.pop();
36863686

3687-
if (Visited.find(BB) != Visited.end())
3687+
if (!Visited.insert(BB).second)
36883688
continue;
3689-
Visited.insert(BB);
36903689
DFS.push_back(BB);
36913690

36923691
for (BinaryBasicBlock *SuccBB : BB->landing_pads()) {
@@ -3879,11 +3878,8 @@ void BinaryFunction::disambiguateJumpTables(
38793878
JumpTable *JT = getJumpTable(Inst);
38803879
if (!JT)
38813880
continue;
3882-
auto Iter = JumpTables.find(JT);
3883-
if (Iter == JumpTables.end()) {
3884-
JumpTables.insert(JT);
3881+
if (JumpTables.insert(JT).second)
38853882
continue;
3886-
}
38873883
// This instruction is an indirect jump using a jump table, but it is
38883884
// using the same jump table of another jump. Try all our tricks to
38893885
// extract the jump table symbol and make it point to a new, duplicated JT

0 commit comments

Comments
 (0)