From 5ad11841f7fe4ae35165e34fb5574f2e4e8499ed Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 24 Apr 2014 23:53:29 +0000 Subject: Revert "Debug info: Let dbg.values inserted by LowerDbgDeclare inherit the location" This reverts commit 207130 for buildbot breakage. llvm-svn: 207159 --- llvm/lib/Transforms/Utils/Local.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Utils') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 9199ed79127..e2ba0473fd1 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -995,7 +995,14 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, DbgVal = Builder.insertDbgValueIntrinsic(ExtendedArg, 0, DIVar, SI); else DbgVal = Builder.insertDbgValueIntrinsic(SI->getOperand(0), 0, DIVar, SI); - DbgVal->setDebugLoc(DDI->getDebugLoc()); + + // Propagate any debug metadata from the store onto the dbg.value. + DebugLoc SIDL = SI->getDebugLoc(); + if (!SIDL.isUnknown()) + DbgVal->setDebugLoc(SIDL); + // Otherwise propagate debug metadata from dbg.declare. + else + DbgVal->setDebugLoc(DDI->getDebugLoc()); return true; } @@ -1015,7 +1022,14 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, Instruction *DbgVal = Builder.insertDbgValueIntrinsic(LI->getOperand(0), 0, DIVar, LI); - DbgVal->setDebugLoc(DDI->getDebugLoc()); + + // Propagate any debug metadata from the store onto the dbg.value. + DebugLoc LIDL = LI->getDebugLoc(); + if (!LIDL.isUnknown()) + DbgVal->setDebugLoc(LIDL); + // Otherwise propagate debug metadata from dbg.declare. + else + DbgVal->setDebugLoc(DDI->getDebugLoc()); return true; } @@ -1054,7 +1068,7 @@ bool llvm::LowerDbgDeclare(Function &F) { auto DbgVal = DIB.insertDbgValueIntrinsic(AI, 0, DIVariable(DDI->getVariable()), I); - DbgVal->setDebugLoc(DDI->getDebugLoc()); + DbgVal->setDebugLoc(I->getDebugLoc()); } DDI->eraseFromParent(); } -- cgit v1.2.3