Skip to content

Commit

Permalink
[BOLT] Avoid repeated set lookups (NFC) (llvm#112157)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored Oct 14, 2024
1 parent 4459a9b commit 23c8340
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bolt/lib/Passes/Instrumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ static bool hasAArch64ExclusiveMemop(
BinaryBasicBlock *BB = BBQueue.front().first;
bool IsLoad = BBQueue.front().second;
BBQueue.pop();
if (Visited.find(BB) != Visited.end())
if (!Visited.insert(BB).second)
continue;
Visited.insert(BB);

for (const MCInst &Inst : *BB) {
// Two loads one after another - skip whole function
Expand All @@ -126,8 +125,7 @@ static bool hasAArch64ExclusiveMemop(
if (BC.MIB->isAArch64ExclusiveLoad(Inst))
IsLoad = true;

if (IsLoad && BBToSkip.find(BB) == BBToSkip.end()) {
BBToSkip.insert(BB);
if (IsLoad && BBToSkip.insert(BB).second) {
if (opts::Verbosity >= 2) {
outs() << "BOLT-INSTRUMENTER: skip BB " << BB->getName()
<< " due to exclusive instruction in function "
Expand Down

0 comments on commit 23c8340

Please sign in to comment.