Skip to content

Commit

Permalink
[BOLT][NFC] Use llvm::is_contained
Browse files Browse the repository at this point in the history
Apply the replacement throughout BOLT.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D145464
  • Loading branch information
aaupov committed Mar 14, 2023
1 parent 16e67e6 commit 2eae9d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bolt/lib/Core/BinaryFunction.cpp
Expand Up @@ -987,7 +987,7 @@ size_t BinaryFunction::getSizeOfDataInCodeAt(uint64_t Offset) const {
if (!Islands)
return 0;

if (Islands->DataOffsets.find(Offset) == Islands->DataOffsets.end())
if (!llvm::is_contained(Islands->DataOffsets, Offset))
return 0;

auto Iter = Islands->CodeOffsets.upper_bound(Offset);
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Passes/FrameAnalysis.cpp
Expand Up @@ -352,7 +352,7 @@ bool FrameAnalysis::updateArgsTouchedFor(const BinaryFunction &BF, MCInst &Inst,
// offset specially after an epilogue, where tailcalls happen. It should be
// -8.
for (std::pair<int64_t, uint8_t> Elem : Iter->second) {
if (ArgsTouchedMap[&BF].find(Elem) == ArgsTouchedMap[&BF].end()) {
if (!llvm::is_contained(ArgsTouchedMap[&BF], Elem)) {
ArgsTouchedMap[&BF].emplace(Elem);
Changed = true;
}
Expand Down
8 changes: 4 additions & 4 deletions bolt/lib/Passes/Instrumentation.cpp
Expand Up @@ -337,7 +337,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
const BinaryBasicBlock *Pred;
std::tie(Pred, BB) = Stack.top();
Stack.pop();
if (VisitedSet.find(BB) != VisitedSet.end())
if (llvm::is_contained(VisitedSet, BB))
continue;

VisitedSet.insert(BB);
Expand Down Expand Up @@ -405,7 +405,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
}
if (TargetFunc) {
// Do not instrument edges in the spanning tree
if (STOutSet[&BB].find(TargetBB) != STOutSet[&BB].end()) {
if (llvm::is_contained(STOutSet[&BB], TargetBB)) {
auto L = BC.scopeLock();
createEdgeDescription(*FuncDesc, Function, FromOffset, BBToID[&BB],
Function, ToOffset, BBToID[TargetBB],
Expand All @@ -422,7 +422,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
if (IsJumpTable) {
for (BinaryBasicBlock *&Succ : BB.successors()) {
// Do not instrument edges in the spanning tree
if (STOutSet[&BB].find(&*Succ) != STOutSet[&BB].end()) {
if (llvm::is_contained(STOutSet[&BB], &*Succ)) {
auto L = BC.scopeLock();
createEdgeDescription(*FuncDesc, Function, FromOffset, BBToID[&BB],
Function, Succ->getInputOffset(),
Expand Down Expand Up @@ -465,7 +465,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
FromOffset = *BC.MIB->getOffset(*LastInstr);

// Do not instrument edges in the spanning tree
if (STOutSet[&BB].find(FTBB) != STOutSet[&BB].end()) {
if (llvm::is_contained(STOutSet[&BB], FTBB)) {
auto L = BC.scopeLock();
createEdgeDescription(*FuncDesc, Function, FromOffset, BBToID[&BB],
Function, FTBB->getInputOffset(), BBToID[FTBB],
Expand Down

0 comments on commit 2eae9d8

Please sign in to comment.