aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 2f94ee16cb..995d6e4baa 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -426,7 +426,7 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
MDNode *TheCallMD = NULL;
SmallVector<Value *, 4> MDVs;
if (TheCall && TheCall->hasMetadata())
- TheCallMD = Context.getMetadata().getMD(DbgKind, TheCall);
+ TheCallMD = TheCall->getMetadata(DbgKind);
// Handle PHI nodes specially, as we have to remove references to dead
// blocks.
@@ -436,32 +436,38 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
for (; (PN = dyn_cast<PHINode>(I)); ++I, ++OldI) {
if (I->hasMetadata()) {
if (TheCallMD) {
- if (MDNode *IMD = Context.getMetadata().getMD(DbgKind, I)) {
+ if (MDNode *IMD = I->getMetadata(DbgKind)) {
MDNode *NewMD = UpdateInlinedAtInfo(IMD, TheCallMD, Context);
- Context.getMetadata().addMD(DbgKind, NewMD, I);
+ I->setMetadata(DbgKind, NewMD);
}
} else {
// The cloned instruction has dbg info but the call instruction
// does not have dbg info. Remove dbg info from cloned instruction.
- Context.getMetadata().removeMD(DbgKind, I);
+ I->setMetadata(DbgKind, 0);
}
}
PHIToResolve.push_back(cast<PHINode>(OldI));
}
}
+ // FIXME:
+ // FIXME:
+ // FIXME: Unclone all this metadata stuff.
+ // FIXME:
+ // FIXME:
+
// Otherwise, remap the rest of the instructions normally.
for (; I != NewBB->end(); ++I) {
if (I->hasMetadata()) {
if (TheCallMD) {
- if (MDNode *IMD = Context.getMetadata().getMD(DbgKind, I)) {
+ if (MDNode *IMD = I->getMetadata(DbgKind)) {
MDNode *NewMD = UpdateInlinedAtInfo(IMD, TheCallMD, Context);
- Context.getMetadata().addMD(DbgKind, NewMD, I);
+ I->setMetadata(DbgKind, NewMD);
}
} else {
// The cloned instruction has dbg info but the call instruction
// does not have dbg info. Remove dbg info from cloned instruction.
- Context.getMetadata().removeMD(DbgKind, I);
+ I->setMetadata(DbgKind, 0);
}
}
RemapInstruction(I, ValueMap);