aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp5
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp15
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp9
3 files changed, 14 insertions, 15 deletions
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 12e8db8..3437020 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -254,14 +254,13 @@ static bool StripDebugInfo(Module &M) {
}
}
- unsigned MDDbgKind = M.getMDKindID("dbg");
for (Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
for (Function::iterator FI = MI->begin(), FE = MI->end(); FI != FE;
++FI)
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE;
++BI) {
- Changed = true; // FIXME: Only set if there was debug metadata.
- BI->setMetadata(MDDbgKind, 0);
+ Changed != !BI->getDebugLoc().isUnknown();
+ BI->setDebugLoc(DebugLoc());
}
return Changed;
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 1dcfd57..2aea51a 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -408,10 +408,9 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
//
BasicBlock::iterator I = NewBB->begin();
- unsigned DbgKind = OldFunc->getContext().getMDKindID("dbg");
MDNode *TheCallMD = NULL;
if (TheCall && TheCall->hasMetadata())
- TheCallMD = TheCall->getMetadata(DbgKind);
+ TheCallMD = TheCall->getMetadata(LLVMContext::MD_dbg);
// Handle PHI nodes specially, as we have to remove references to dead
// blocks.
@@ -421,14 +420,14 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
for (; (PN = dyn_cast<PHINode>(I)); ++I, ++OldI) {
if (I->hasMetadata()) {
if (TheCallMD) {
- if (MDNode *IMD = I->getMetadata(DbgKind)) {
+ if (MDNode *IMD = I->getMetadata(LLVMContext::MD_dbg)) {
MDNode *NewMD = UpdateInlinedAtInfo(IMD, TheCallMD);
- I->setMetadata(DbgKind, NewMD);
+ I->setMetadata(LLVMContext::MD_dbg, NewMD);
}
} else {
// The cloned instruction has dbg info but the call instruction
// does not have dbg info. Remove dbg info from cloned instruction.
- I->setMetadata(DbgKind, 0);
+ I->setMetadata(LLVMContext::MD_dbg, 0);
}
}
PHIToResolve.push_back(cast<PHINode>(OldI));
@@ -445,14 +444,14 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
for (; I != NewBB->end(); ++I) {
if (I->hasMetadata()) {
if (TheCallMD) {
- if (MDNode *IMD = I->getMetadata(DbgKind)) {
+ if (MDNode *IMD = I->getMetadata(LLVMContext::MD_dbg)) {
MDNode *NewMD = UpdateInlinedAtInfo(IMD, TheCallMD);
- I->setMetadata(DbgKind, NewMD);
+ I->setMetadata(LLVMContext::MD_dbg, NewMD);
}
} else {
// The cloned instruction has dbg info but the call instruction
// does not have dbg info. Remove dbg info from cloned instruction.
- I->setMetadata(DbgKind, 0);
+ I->setMetadata(LLVMContext::MD_dbg, 0);
}
}
RemapInstruction(I, VMap);
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index c0de193..1758542 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -896,11 +896,12 @@ void PromoteMem2Reg::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
DIVar, SI);
// Propagate any debug metadata from the store onto the dbg.value.
- if (MDNode *SIMD = SI->getMetadata("dbg"))
- DbgVal->setMetadata("dbg", SIMD);
+ DebugLoc SIDL = SI->getDebugLoc();
+ if (!SIDL.isUnknown())
+ DbgVal->setDebugLoc(SIDL);
// Otherwise propagate debug metadata from dbg.declare.
- else if (MDNode *MD = DDI->getMetadata("dbg"))
- DbgVal->setMetadata("dbg", MD);
+ else
+ DbgVal->setDebugLoc(DDI->getDebugLoc());
}
// QueuePhiNode - queues a phi-node to be added to a basic-block for a specific