mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-02 10:33:53 +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:
parent
d3b31a73e8
commit
2c9ad13b14
@ -392,7 +392,19 @@ static Value *RemapOperand(const Value *In,
|
||||
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
||||
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);
|
||||
} else if (isa<InlineAsm>(In)) {
|
||||
Result = const_cast<Value*>(In);
|
||||
|
Loading…
x
Reference in New Issue
Block a user