[llvm] [llvm-objdump] Optimize live element tracking (PR #158763)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 01:51:55 PST 2025
================
@@ -147,18 +152,34 @@ void LiveElementPrinter::addVariable(DWARFDie FuncDie, DWARFDie VarDie) {
}
for (const DWARFLocationExpression &LocExpr : *Locs) {
+ std::unique_ptr<LiveVariable> NewVar;
if (LocExpr.Range) {
- LiveElements.emplace_back(
- std::make_unique<LiveVariable>(LocExpr, VarName, U, FuncDie));
+ NewVar = std::make_unique<LiveVariable>(LocExpr, VarName, U, FuncDie);
----------------
jh7370 wrote:
Rather than creating a local variable here and in the else clause, then immediately moving it after the if/else, perhaps you could have a new function along the lines of `createNewLiveVariable` that creates the entry in `LiveElements` directly, like before, and adds it to the various data structures too? I think it would help reduce the size of this function, which is getting a bit big.
https://github.com/llvm/llvm-project/pull/158763
More information about the llvm-commits
mailing list