diff options
author | Dehao Chen <dehao@google.com> | 2016-02-29 18:59:48 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-02-29 18:59:48 +0000 |
commit | 939993ff2fe38eca498b0806b22a35412222a0eb (patch) | |
tree | a5a4778aee089d09bd035f4b520f2b25a3dd2885 /llvm/lib/Transforms | |
parent | 522b5cb3753f39ceb021ab2511c54d7163940b06 (diff) | |
download | bcm5719-llvm-939993ff2fe38eca498b0806b22a35412222a0eb.tar.gz bcm5719-llvm-939993ff2fe38eca498b0806b22a35412222a0eb.zip |
Move discriminator assignment to the right place.
Summary: Now discriminator is assigned per-function instead of per-module.
Reviewers: davidxl, dnovillo
Subscribers: dblaikie, llvm-commits
Differential Revision: http://reviews.llvm.org/D17664
llvm-svn: 262240
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 3e585c623dd..e0f58606d63 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -173,8 +173,10 @@ bool AddDiscriminators::runOnFunction(Function &F) { typedef std::pair<StringRef, unsigned> Location; typedef DenseMap<const BasicBlock *, Metadata *> BBScopeMap; typedef DenseMap<Location, BBScopeMap> LocationBBMap; + typedef DenseMap<Location, unsigned> LocationDiscriminatorMap; LocationBBMap LBM; + LocationDiscriminatorMap LDM; // Traverse all instructions in the function. If the source line location // of the instruction appears in other basic block, assign a new @@ -199,8 +201,7 @@ bool AddDiscriminators::runOnFunction(Function &F) { auto *Scope = DIL->getScope(); auto *File = Builder.createFile(DIL->getFilename(), Scope->getDirectory()); - NewScope = Builder.createLexicalBlockFile( - Scope, File, DIL->computeNewDiscriminator()); + NewScope = Builder.createLexicalBlockFile(Scope, File, ++LDM[L]); } I.setDebugLoc(DILocation::get(Ctx, DIL->getLine(), DIL->getColumn(), NewScope, DIL->getInlinedAt())); @@ -230,8 +231,10 @@ bool AddDiscriminators::runOnFunction(Function &F) { auto *Scope = FirstDIL->getScope(); auto *File = Builder.createFile(FirstDIL->getFilename(), Scope->getDirectory()); - auto *NewScope = Builder.createLexicalBlockFile( - Scope, File, FirstDIL->computeNewDiscriminator()); + Location L = + std::make_pair(FirstDIL->getFilename(), FirstDIL->getLine()); + auto *NewScope = + Builder.createLexicalBlockFile(Scope, File, ++LDM[L]); Current->setDebugLoc(DILocation::get( Ctx, CurrentDIL->getLine(), CurrentDIL->getColumn(), NewScope, CurrentDIL->getInlinedAt())); |