diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-15 16:11:41 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-15 16:11:41 +0000 |
| commit | 3bfffde27a820789b37a0c6e3d7f32d3757f4b32 (patch) | |
| tree | 6afe88db9b138aa9fb7b045130879ec7fd087de4 /llvm/lib/IR/DIBuilder.cpp | |
| parent | 146700ee64055aa49b5a5a690ac3bac8075e9aaa (diff) | |
| download | bcm5719-llvm-3bfffde27a820789b37a0c6e3d7f32d3757f4b32.tar.gz bcm5719-llvm-3bfffde27a820789b37a0c6e3d7f32d3757f4b32.zip | |
DI: Use a `DenseMap` instead of named metadata, NFC
Remove a strange round-trip through named metadata to assign preserved
local variables to their subprograms.
llvm-svn: 219798
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
| -rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index c131b544b5f..3276fe6452a 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -73,13 +73,10 @@ void DIBuilder::finalize() { DIType(TempSubprograms).replaceAllUsesWith(SPs); for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); - SmallVector<Value *, 4> Variables; - if (NamedMDNode *NMD = getFnSpecificMDNode(M, SP)) { - for (unsigned ii = 0, ee = NMD->getNumOperands(); ii != ee; ++ii) - Variables.push_back(NMD->getOperand(ii)); - NMD->eraseFromParent(); - } if (MDNode *Temp = SP.getVariablesNodes()) { + SmallVector<Value *, 4> Variables; + for (Value *V : PreservedVariables.lookup(SP)) + Variables.push_back(V); DIArray AV = getOrCreateArray(Variables); DIType(Temp).replaceAllUsesWith(AV); } @@ -906,8 +903,8 @@ DIVariable DIBuilder::createLocalVariable(unsigned Tag, DIDescriptor Scope, // to preserve variable info in such situation then stash it in a // named mdnode. DISubprogram Fn(getDISubprogram(Scope)); - NamedMDNode *FnLocals = getOrInsertFnSpecificMDNode(M, Fn); - FnLocals->addOperand(Node); + assert(Fn && "Missing subprogram for local variable"); + PreservedVariables[Fn].push_back(Node); } DIVariable RetVar(Node); assert(RetVar.isVariable() && |

