diff options
author | Pavel Labath <labath@google.com> | 2015-11-16 10:40:38 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2015-11-16 10:40:38 +0000 |
commit | 978060ce2f70a9fb8f7c0d4203d5172980f9c8ea (patch) | |
tree | 164f4150b12ace037536cf3a2d45695749db4341 /llvm/lib/Transforms | |
parent | db9081bf89aa2b603d660896bd6f933a5f011e3b (diff) | |
download | bcm5719-llvm-978060ce2f70a9fb8f7c0d4203d5172980f9c8ea.tar.gz bcm5719-llvm-978060ce2f70a9fb8f7c0d4203d5172980f9c8ea.zip |
Don't generate discriminators for calls to debug intrinsics
Summary:
This fails a check in Verifier.cpp, which checks for location matches between the declared
variable and the !dbg attachments.
Reviewers: dnovillo, dblaikie, danielcdh
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14657
llvm-svn: 253194
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 9125b583212..db2bf6a2a9f 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -58,6 +58,7 @@ #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/Pass.h" @@ -233,26 +234,27 @@ bool AddDiscriminators::runOnFunction(Function &F) { const DILocation *FirstDIL = NULL; for (auto &I : B.getInstList()) { CallInst *Current = dyn_cast<CallInst>(&I); - if (Current) { - DILocation *CurrentDIL = Current->getDebugLoc(); - if (FirstDIL) { - if (CurrentDIL && CurrentDIL->getLine() == FirstDIL->getLine() && - CurrentDIL->getFilename() == FirstDIL->getFilename()) { - auto *Scope = FirstDIL->getScope(); - auto *File = Builder.createFile(FirstDIL->getFilename(), - Scope->getDirectory()); - auto *NewScope = Builder.createLexicalBlockFile( - Scope, File, FirstDIL->computeNewDiscriminator()); - Current->setDebugLoc(DILocation::get( - Ctx, CurrentDIL->getLine(), CurrentDIL->getColumn(), NewScope, - CurrentDIL->getInlinedAt())); - Changed = true; - } else { - FirstDIL = CurrentDIL; - } + if (!Current || isa<DbgInfoIntrinsic>(&I)) + continue; + + DILocation *CurrentDIL = Current->getDebugLoc(); + if (FirstDIL) { + if (CurrentDIL && CurrentDIL->getLine() == FirstDIL->getLine() && + CurrentDIL->getFilename() == FirstDIL->getFilename()) { + auto *Scope = FirstDIL->getScope(); + auto *File = Builder.createFile(FirstDIL->getFilename(), + Scope->getDirectory()); + auto *NewScope = Builder.createLexicalBlockFile( + Scope, File, FirstDIL->computeNewDiscriminator()); + Current->setDebugLoc(DILocation::get( + Ctx, CurrentDIL->getLine(), CurrentDIL->getColumn(), NewScope, + CurrentDIL->getInlinedAt())); + Changed = true; } else { FirstDIL = CurrentDIL; } + } else { + FirstDIL = CurrentDIL; } } } |