diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
commit | 6fe5c7aa327e188b7176daa5595bbf075a6b94df (patch) | |
tree | 4cfca640904d1896e25032757a61f8959c066919 /lib/Linker/LinkModules.cpp | |
parent | 989df958a10f0beb90b89ccadd8351cbe51d90b1 (diff) |
Notes
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index e2cd47a21b39..7f441b0a4715 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -392,9 +392,20 @@ static Value *RemapOperand(const Value *In, assert(!isa<GlobalValue>(CPV) && "Unmapped global?"); llvm_unreachable("Unknown type of derived type constant value!"); } - } else if (isa<MDNode>(In) || isa<MDString>(In)) { - Result = const_cast<Value*>(In); - } else if (isa<InlineAsm>(In)) { + } else if (const MDNode *MD = dyn_cast<MDNode>(In)) { + if (MD->isFunctionLocal()) { + SmallVector<Value*, 4> Elts; + for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) { + if (MD->getOperand(i)) + Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap)); + else + Elts.push_back(NULL); + } + Result = MDNode::get(In->getContext(), Elts.data(), MD->getNumOperands()); + } else { + Result = const_cast<Value*>(In); + } + } else if (isa<MDString>(In) || isa<InlineAsm>(In) || isa<Instruction>(In)) { Result = const_cast<Value*>(In); } |