summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 19:49:49 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 19:49:49 +0000
commitec819c096b9babe09ccf93db1709f6b04c706a3c (patch)
tree67a413cf878c6d12135ad1a8286693b13c9c0937 /llvm/lib/Transforms/Utils/AddDiscriminators.cpp
parente50adcb6b1b7e8317cca7ed5f8860a40ca6b7196 (diff)
downloadbcm5719-llvm-ec819c096b9babe09ccf93db1709f6b04c706a3c.tar.gz
bcm5719-llvm-ec819c096b9babe09ccf93db1709f6b04c706a3c.zip
Transforms: Use the new DebugLoc API, NFC
Update lib/Analysis and lib/Transforms to use the new `DebugLoc` API. llvm-svn: 233587
Diffstat (limited to 'llvm/lib/Transforms/Utils/AddDiscriminators.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/AddDiscriminators.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
index 820544bcebf..0379736f15d 100644
--- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
+++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
@@ -174,16 +174,16 @@ bool AddDiscriminators::runOnFunction(Function &F) {
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
BasicBlock *B = I;
TerminatorInst *Last = B->getTerminator();
- DebugLoc LastLoc = Last->getDebugLoc();
- if (LastLoc.isUnknown()) continue;
- DILocation LastDIL(LastLoc.getAsMDNode(Ctx));
+ DILocation LastDIL = Last->getDebugLoc().get();
+ if (!LastDIL)
+ continue;
for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) {
BasicBlock *Succ = Last->getSuccessor(I);
Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime();
- DebugLoc FirstLoc = First->getDebugLoc();
- if (FirstLoc.isUnknown()) continue;
- DILocation FirstDIL(FirstLoc.getAsMDNode(Ctx));
+ DILocation FirstDIL = First->getDebugLoc().get();
+ if (!FirstDIL)
+ continue;
// If the first instruction (First) of Succ is at the same file
// location as B's last instruction (Last), add a new
@@ -199,13 +199,14 @@ bool AddDiscriminators::runOnFunction(Function &F) {
DILexicalBlockFile NewScope =
Builder.createLexicalBlockFile(Scope, File, Discriminator);
DILocation NewDIL = FirstDIL.copyWithNewScope(Ctx, NewScope);
- DebugLoc newDebugLoc = DebugLoc::getFromDILocation(NewDIL);
+ DebugLoc newDebugLoc = NewDIL.get();
// Attach this new debug location to First and every
// instruction following First that shares the same location.
for (BasicBlock::iterator I1(*First), E1 = Succ->end(); I1 != E1;
++I1) {
- if (I1->getDebugLoc() != FirstLoc) break;
+ if (I1->getDebugLoc().get() != FirstDIL)
+ break;
I1->setDebugLoc(newDebugLoc);
DEBUG(dbgs() << NewDIL.getFilename() << ":" << NewDIL.getLineNumber()
<< ":" << NewDIL.getColumnNumber() << ":"
OpenPOWER on IntegriCloud