diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-21 22:45:21 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-21 22:45:21 +0000 |
commit | 2f3f76fdb14a25fa27773bf415f61d7b10d53d62 (patch) | |
tree | 08752e73a58574306840eb1ead039fd731e07a3d /llvm/lib/IR/DIBuilder.cpp | |
parent | 3e9af0dd1d1b6c5ce4164b9eedda7512b4761027 (diff) | |
download | bcm5719-llvm-2f3f76fdb14a25fa27773bf415f61d7b10d53d62.tar.gz bcm5719-llvm-2f3f76fdb14a25fa27773bf415f61d7b10d53d62.zip |
Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator changes to ensure discriminator changes don't introduce new DWARF DW_TAG_lexical_blocks.
Somewhat unnoticed in the original implementation of discriminators, but
it could cause instructions to end up in new, small,
DW_TAG_lexical_blocks due to the use of DILexicalBlock to track
discriminator changes.
Instead, use DILexicalBlockFile which we already use to track file
changes without introducing new scopes, so it works well to track
discriminator changes in the same way.
llvm-svn: 216239
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index a621f71a7f5..c3beae9a28b 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1249,11 +1249,13 @@ DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name, /// createLexicalBlockFile - This creates a new MDNode that encapsulates /// an existing scope with a new filename. DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope, - DIFile File) { + DIFile File, + unsigned Discriminator) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block), File.getFileNode(), - Scope + Scope, + ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator), }; DILexicalBlockFile R(MDNode::get(VMContext, Elts)); assert( @@ -1263,8 +1265,7 @@ DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope, } DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, - unsigned Line, unsigned Col, - unsigned Discriminator) { + unsigned Line, unsigned Col) { // FIXME: This isn't thread safe nor the right way to defeat MDNode uniquing. // I believe the right way is to have a self-referential element in the node. // Also: why do we bother with line/column - they're not used and the @@ -1280,7 +1281,6 @@ DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, getNonCompileUnitScope(Scope), ConstantInt::get(Type::getInt32Ty(VMContext), Line), ConstantInt::get(Type::getInt32Ty(VMContext), Col), - ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator), ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++) }; DILexicalBlock R(MDNode::get(VMContext, Elts)); |