mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 21:47:07 +00:00
Enable MDNode uniquing.
llvm-svn: 81355
This commit is contained in:
parent
6fb286fc2e
commit
2898d3cb86
@ -90,16 +90,11 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
|
|||||||
for (unsigned i = 0; i != NumVals; ++i)
|
for (unsigned i = 0; i != NumVals; ++i)
|
||||||
ID.AddPointer(Vals[i]);
|
ID.AddPointer(Vals[i]);
|
||||||
|
|
||||||
// FIXME: MDNode uniquing disabled temporarily.
|
|
||||||
#ifndef ENABLE_MDNODE_UNIQUING
|
|
||||||
return new MDNode(Context, Vals, NumVals);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pImpl->ConstantsLock.reader_acquire();
|
pImpl->ConstantsLock.reader_acquire();
|
||||||
void *InsertPoint;
|
void *InsertPoint;
|
||||||
MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
|
MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
|
||||||
pImpl->ConstantsLock.reader_release();
|
pImpl->ConstantsLock.reader_release();
|
||||||
|
|
||||||
if (!N) {
|
if (!N) {
|
||||||
sys::SmartScopedWriter<true> Writer(pImpl->ConstantsLock);
|
sys::SmartScopedWriter<true> Writer(pImpl->ConstantsLock);
|
||||||
N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
|
N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
|
||||||
@ -120,27 +115,12 @@ void MDNode::dropAllReferences() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MDNode::~MDNode() {
|
MDNode::~MDNode() {
|
||||||
// FIXME: MDNode uniquing disabled temporarily.
|
|
||||||
#ifdef ENABLE_MDNODE_UNIQUING
|
|
||||||
getType()->getContext().pImpl->MDNodeSet.RemoveNode(this);
|
getType()->getContext().pImpl->MDNodeSet.RemoveNode(this);
|
||||||
#endif
|
|
||||||
dropAllReferences();
|
dropAllReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace value from this node's element list.
|
// Replace value from this node's element list.
|
||||||
void MDNode::replaceElement(Value *From, Value *To) {
|
void MDNode::replaceElement(Value *From, Value *To) {
|
||||||
// FIXME: MDNode uniquing disabled temporarily.
|
|
||||||
#ifndef ENABLE_MDNODE_UNIQUING
|
|
||||||
if (From == To || !getType())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (SmallVector<ElementVH, 4>::iterator I = Node.begin(),
|
|
||||||
E = Node.end(); I != E; ++I)
|
|
||||||
if (*I && *I == From)
|
|
||||||
*I = ElementVH(To, this);
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (From == To || !getType())
|
if (From == To || !getType())
|
||||||
return;
|
return;
|
||||||
LLVMContext &Context = getType()->getContext();
|
LLVMContext &Context = getType()->getContext();
|
||||||
|
Loading…
Reference in New Issue
Block a user