mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Linker needs to do deep-copy of function-local metadata to update references to function arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -392,7 +392,19 @@ static Value *RemapOperand(const Value *In,
|
|||||||
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
||||||
llvm_unreachable("Unknown type of derived type constant value!");
|
llvm_unreachable("Unknown type of derived type constant value!");
|
||||||
}
|
}
|
||||||
} else if (isa<MDNode>(In) || isa<MDString>(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);
|
||||||
|
}
|
||||||
|
Result = MDNode::get(In->getContext(), Elts.data(), MD->getNumOperands());
|
||||||
|
} else {
|
||||||
|
Result = const_cast<Value*>(In);
|
||||||
|
}
|
||||||
|
} else if (isa<MDString>(In)) {
|
||||||
Result = const_cast<Value*>(In);
|
Result = const_cast<Value*>(In);
|
||||||
} else if (isa<InlineAsm>(In)) {
|
} else if (isa<InlineAsm>(In)) {
|
||||||
Result = const_cast<Value*>(In);
|
Result = const_cast<Value*>(In);
|
||||||
|
Reference in New Issue
Block a user