mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-03 10:27:09 +00:00
IR: Stop copying vectors of TrackingMDRef in DIBuilder
No real functionality change here, just avoiding an unnecessary copy of std::vector<TrackingMDRef> for every subprogram with variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266907 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
923c75e572
commit
7c73f3f39c
@ -97,12 +97,18 @@ void DIBuilder::finalize() {
|
||||
|
||||
DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
|
||||
auto resolveVariables = [&](DISubprogram *SP) {
|
||||
if (MDTuple *Temp = SP->getVariables().get()) {
|
||||
const auto &PV = PreservedVariables.lookup(SP);
|
||||
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
|
||||
DINodeArray AV = getOrCreateArray(Variables);
|
||||
TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
|
||||
}
|
||||
MDTuple *Temp = SP->getVariables().get();
|
||||
if (!Temp)
|
||||
return;
|
||||
|
||||
SmallVector<Metadata *, 4> Variables;
|
||||
|
||||
auto PV = PreservedVariables.find(SP);
|
||||
if (PV != PreservedVariables.end())
|
||||
Variables.append(PV->second.begin(), PV->second.end());
|
||||
|
||||
DINodeArray AV = getOrCreateArray(Variables);
|
||||
TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
|
||||
};
|
||||
for (auto *SP : SPs)
|
||||
resolveVariables(SP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user