mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-17 23:44:43 +00:00
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
This commit is contained in:
parent
e98585eb36
commit
7bf5cf401f
@ -395,16 +395,13 @@ 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) {
|
||||
Value *Op = MD->getOperand(i);
|
||||
// LinkFunctionBody() already handled non-argument values.
|
||||
Elts.push_back(isa<Argument>(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<Value*>(In);
|
||||
}
|
||||
} else if (isa<MDString>(In) || isa<InlineAsm>(In)) {
|
||||
} else if (isa<MDString>(In) || isa<InlineAsm>(In) || isa<Instruction>(In)) {
|
||||
Result = const_cast<Value*>(In);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user