Introduce a new temporary MDNode concept. Temporary MDNodes are
not part of the IR, are not uniqued, and may be safely RAUW'd. This replaces a variety of alternate mechanisms for achieving the same effect. llvm-svn: 111681
This commit is contained in:
@@ -333,9 +333,9 @@ void BitcodeReaderMDValueList::AssignValue(Value *V, unsigned Idx) {
|
||||
}
|
||||
|
||||
// If there was a forward reference to this value, replace it.
|
||||
Value *PrevVal = OldV;
|
||||
MDNode *PrevVal = cast<MDNode>(OldV);
|
||||
OldV->replaceAllUsesWith(V);
|
||||
delete PrevVal;
|
||||
MDNode::deleteTemporary(PrevVal);
|
||||
// Deleting PrevVal sets Idx value in MDValuePtrs to null. Set new
|
||||
// value for Idx.
|
||||
MDValuePtrs[Idx] = V;
|
||||
@@ -351,7 +351,7 @@ Value *BitcodeReaderMDValueList::getValueFwdRef(unsigned Idx) {
|
||||
}
|
||||
|
||||
// Create and return a placeholder, which will later be RAUW'd.
|
||||
Value *V = new Argument(Type::getMetadataTy(Context));
|
||||
Value *V = MDNode::getTemporary(Context, 0, 0);
|
||||
MDValuePtrs[Idx] = V;
|
||||
return V;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user