mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
When a function-local value with function-local metadata uses gets RAUWed with a
non-function-local value, it may result in the metadata no longer needing to be function-local. Check for this condition, and clear the isFunctionLocal flag, if it's still in the uniquing map, since any node in the uniquing map needs to have an accurate function-local flag. Also, add an assert to help catch problematic cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
338f3acb7f
commit
5781f3e9fc
@ -354,6 +354,22 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
|
||||
|
||||
// InsertPoint will have been set by the FindNodeOrInsertPos call.
|
||||
pImpl->MDNodeSet.InsertNode(this, InsertPoint);
|
||||
|
||||
// If this MDValue was previously function-local but no longer is, clear
|
||||
// its function-local flag.
|
||||
if (isFunctionLocal() && !isFunctionLocalValue(To)) {
|
||||
bool isStillFunctionLocal = false;
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||
Value *V = getOperand(i);
|
||||
if (!V) continue;
|
||||
if (isFunctionLocalValue(V)) {
|
||||
isStillFunctionLocal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isStillFunctionLocal)
|
||||
setValueSubclassData(getSubclassDataFromValue() & ~FunctionLocalBit);
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -387,6 +403,8 @@ MDNode *NamedMDNode::getOperand(unsigned i) const {
|
||||
|
||||
/// addOperand - Add metadata Operand.
|
||||
void NamedMDNode::addOperand(MDNode *M) {
|
||||
assert(!M->isFunctionLocal() &&
|
||||
"NamedMDNode operands must not be function-local!");
|
||||
getNMDOps(Operands).push_back(TrackingVH<MDNode>(M));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user