Skip to content

[BOLT] Avoid repeated map lookups (NFC) #112118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3684,9 +3684,8 @@ BinaryFunction::BasicBlockListType BinaryFunction::dfs() const {
BinaryBasicBlock *BB = Stack.top();
Stack.pop();

if (Visited.find(BB) != Visited.end())
if (!Visited.insert(BB).second)
continue;
Visited.insert(BB);
DFS.push_back(BB);

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