forked from OSchip/llvm-project
Linker should not remap null operands of metadata
llvm-svn: 95468
This commit is contained in:
parent
1b08138152
commit
827de51a4a
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue