From: Victor Hernandez Date: Wed, 27 Jan 2010 22:03:03 +0000 (+0000) Subject: Need to recurse for all operands of function-local metadata; and handle Instructions... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7bf5cf401f27ac7cafe3e2c097cf14b7bb30a653;p=oota-llvm.git Need to recurse for all operands of function-local metadata; and handle Instructions (which map to themselves) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94691 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 86f3b84f1d7..279c4bec357 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -395,16 +395,13 @@ static Value *RemapOperand(const Value *In, } else if (const MDNode *MD = dyn_cast(In)) { if (MD->isFunctionLocal()) { SmallVector Elts; - for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) { - Value *Op = MD->getOperand(i); - // LinkFunctionBody() already handled non-argument values. - Elts.push_back(isa(Op) ? RemapOperand(Op, ValueMap) : Op); - } + for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) + Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap)); Result = MDNode::get(In->getContext(), Elts.data(), MD->getNumOperands()); } else { Result = const_cast(In); } - } else if (isa(In) || isa(In)) { + } else if (isa(In) || isa(In) || isa(In)) { Result = const_cast(In); }