Linker should not remap null operands of metadata

llvm-svn: 95468
This commit is contained in:
Victor Hernandez 2010-02-06 01:31:55 +00:00
parent 1b08138152
commit 827de51a4a
1 changed files with 6 additions and 2 deletions

View File

@ -395,8 +395,12 @@ static Value *RemapOperand(const Value *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)
Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap));
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);