mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
AsmPrinter: Stop creating DebugLocs
While looking at a heap profile of a clang LTO bootstrap with -g, I noticed that 2.2% of memory in an `llvm-lto` of clang is from calling `DebugLoc::get()` in `collectVariableInfo()` (accounting for ~40% of memory used for `MDLocation`s). I suspect this was introduced by r226736, whose goal was to prevent uniquing of `DebugLoc`s (goal achieved, if so). There's no reason we need a `DebugLoc` here at all -- it was just being used for (in)convenient API -- so the fix is to pass the scope and inlined-at directly to `LexicalScopes::findInlinedScope()`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -180,9 +180,11 @@ public:
|
|||||||
return I != AbstractScopeMap.end() ? &I->second : nullptr;
|
return I != AbstractScopeMap.end() ? &I->second : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// findInlinedScope - Find an inlined scope for the given DebugLoc or return
|
/// findInlinedScope - Find an inlined scope for the given scope/inlined-at.
|
||||||
/// NULL.
|
LexicalScope *findInlinedScope(const MDNode *N, const MDNode *IA) {
|
||||||
LexicalScope *findInlinedScope(DebugLoc DL);
|
auto I = InlinedLexicalScopeMap.find(std::make_pair(N, IA));
|
||||||
|
return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/// findLexicalScope - Find regular lexical scope or return null.
|
/// findLexicalScope - Find regular lexical scope or return null.
|
||||||
LexicalScope *findLexicalScope(const MDNode *N) {
|
LexicalScope *findLexicalScope(const MDNode *N) {
|
||||||
|
@@ -949,11 +949,9 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
LexicalScope *Scope = nullptr;
|
LexicalScope *Scope = nullptr;
|
||||||
if (MDNode *IA = DV.getInlinedAt()) {
|
if (MDNode *IA = DV.getInlinedAt())
|
||||||
DebugLoc DL = DebugLoc::getFromDILocation(IA);
|
Scope = LScopes.findInlinedScope(DV.getContext(), IA);
|
||||||
Scope = LScopes.findInlinedScope(DebugLoc::get(
|
else
|
||||||
DL.getLine(), DL.getCol(), DV.getContext(), IA));
|
|
||||||
} else
|
|
||||||
Scope = LScopes.findLexicalScope(DV.getContext());
|
Scope = LScopes.findLexicalScope(DV.getContext());
|
||||||
// If variable scope is not found then skip this variable.
|
// If variable scope is not found then skip this variable.
|
||||||
if (!Scope)
|
if (!Scope)
|
||||||
|
@@ -104,14 +104,6 @@ void LexicalScopes::extractLexicalScopes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LexicalScope *LexicalScopes::findInlinedScope(DebugLoc DL) {
|
|
||||||
MDNode *Scope = nullptr;
|
|
||||||
MDNode *IA = nullptr;
|
|
||||||
DL.getScopeAndInlinedAt(Scope, IA, MF->getFunction()->getContext());
|
|
||||||
auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
|
|
||||||
return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
|
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
|
||||||
/// given DebugLoc. Return NULL if not found.
|
/// given DebugLoc. Return NULL if not found.
|
||||||
LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
||||||
|
Reference in New Issue
Block a user