diff options
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 774dce0642..6ef160b972 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -1053,8 +1053,12 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, // The optimizer may remove local variable. If there is an interest // to preserve variable info in such situation then stash it in a // named mdnode. - NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.lv"); - NMD->addOperand(Node); + DISubprogram Fn(getDISubprogram(Context)); + const Twine FnLVName = Twine("llvm.dbg.lv.", Fn.getName()); + NamedMDNode *FnLocals = M.getNamedMetadataUsingTwine(FnLVName); + if (!FnLocals) + FnLocals = NamedMDNode::Create(VMContext, FnLVName, NULL, 0, &M); + FnLocals->addOperand(Node); } return DIVariable(Node); } |