forked from OSchip/llvm-project
[ModuleSummaryAnalysis] Avoid duplicate elements in Worklist. NFC
This commit is contained in:
parent
fb2cf0dd60
commit
e6a104465d
|
@ -91,14 +91,11 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser,
|
|||
SmallPtrSet<const User *, 8> &Visited) {
|
||||
bool HasBlockAddress = false;
|
||||
SmallVector<const User *, 32> Worklist;
|
||||
Worklist.push_back(CurUser);
|
||||
if (Visited.insert(CurUser).second)
|
||||
Worklist.push_back(CurUser);
|
||||
|
||||
while (!Worklist.empty()) {
|
||||
const User *U = Worklist.pop_back_val();
|
||||
|
||||
if (!Visited.insert(U).second)
|
||||
continue;
|
||||
|
||||
const auto *CB = dyn_cast<CallBase>(U);
|
||||
|
||||
for (const auto &OI : U->operands()) {
|
||||
|
@ -117,7 +114,8 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser,
|
|||
RefEdges.insert(Index.getOrInsertValueInfo(GV));
|
||||
continue;
|
||||
}
|
||||
Worklist.push_back(Operand);
|
||||
if (Visited.insert(Operand).second)
|
||||
Worklist.push_back(Operand);
|
||||
}
|
||||
}
|
||||
return HasBlockAddress;
|
||||
|
|
Loading…
Reference in New Issue