mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01: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. llvm-svn: 266907
This commit is contained in:
parent
d328bd016e
commit
f75e13b583
@ -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…
Reference in New Issue
Block a user