1
0
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:
Duncan P. N. Exon Smith 2016-04-20 20:03:59 +00:00
parent d328bd016e
commit f75e13b583

View File

@ -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);