1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Revert "unique_ptrify LLVMContextImpl::CAZConstants"

Missed the complexities of how these elements are destroyed.

This reverts commit r222714.

llvm-svn: 222715
This commit is contained in:
David Blaikie 2014-11-25 02:26:22 +00:00
parent 14dc3c5b02
commit de835e646d
3 changed files with 6 additions and 9 deletions

View File

@ -1331,11 +1331,11 @@ ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) {
assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
"Cannot create an aggregate zero of non-aggregate type!");
auto &Entry = Ty->getContext().pImpl->CAZConstants[Ty];
ConstantAggregateZero *&Entry = Ty->getContext().pImpl->CAZConstants[Ty];
if (!Entry)
Entry.reset(new ConstantAggregateZero(Ty));
Entry = new ConstantAggregateZero(Ty);
return Entry.get();
return Entry;
}
/// destroyConstant - Remove the constant from the constant table.

View File

@ -87,7 +87,7 @@ LLVMContextImpl::~LLVMContextImpl() {
ArrayConstants.freeConstants();
StructConstants.freeConstants();
VectorConstants.freeConstants();
CAZConstants.clear();
DeleteContainerSeconds(CAZConstants);
DeleteContainerSeconds(CPNConstants);
DeleteContainerSeconds(UVConstants);
InlineAsms.freeConstants();

View File

@ -299,10 +299,7 @@ public:
// on Context destruction.
SmallPtrSet<GenericMDNode *, 1> NonUniquedMDNodes;
// Value is indirected through pointer to keep pointer validity over mutations
// of this map. Replace if/when we have an efficient map that guarantees
// pointer validity over mutations.
DenseMap<Type*, std::unique_ptr<ConstantAggregateZero>> CAZConstants;
DenseMap<Type*, ConstantAggregateZero*> CAZConstants;
typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
ArrayConstantsTy ArrayConstants;