Skip to content

Commit

Permalink
Don't add irrelevant items to queue in DwarfCompileUnit::createScopeC…
Browse files Browse the repository at this point in the history
…hildrenDIE (NFC)

Instead of popping them and then immediately throwing them away, we can
just filter out globals and items in different scopes before adding them
to WorkList. Shouldn't change anything but keep the queue smaller.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D113864
  • Loading branch information
aaronpuchert committed Nov 16, 2021
1 parent 86b3100 commit b20da51
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Expand Up @@ -980,9 +980,7 @@ sortLocalVars(SmallVectorImpl<DbgVariable *> &Input) {
bool visitedAllDependencies = Item.getInt();
WorkList.pop_back();

// Dependency is in a different lexical scope or a global.
if (!Var)
continue;
assert(Var);

// Already handled.
if (Visited.count(Var))
Expand All @@ -1006,8 +1004,10 @@ sortLocalVars(SmallVectorImpl<DbgVariable *> &Input) {
// visited again after all of its dependencies are handled.
WorkList.push_back({Var, 1});
for (auto *Dependency : dependencies(Var)) {
auto Dep = dyn_cast_or_null<const DILocalVariable>(Dependency);
WorkList.push_back({DbgVar[Dep], 0});
// Don't add dependency if it is in a different lexical scope or a global.
if (const auto *Dep = dyn_cast<const DILocalVariable>(Dependency))
if (DbgVariable *Var = DbgVar.lookup(Dep))
WorkList.push_back({Var, 0});
}
}
return Result;
Expand Down

0 comments on commit b20da51

Please sign in to comment.