From: Owen Anderson Date: Thu, 16 Sep 2010 00:27:35 +0000 (+0000) Subject: Fix a threaded LLVM bug due the need for operator= on reference counted AttrListImpl... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=cb86def1c2084f2b1c72fd04e5384d472e7cf3a0;p=oota-llvm.git Fix a threaded LLVM bug due the need for operator= on reference counted AttrListImpl's. It might be possible to implement this very carefully to allow a lock-free implementation while still avoiding illegal interleavings, but I haven't been able to figure one out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114046 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index a000aee2ab4..3422faf2730 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -195,6 +195,7 @@ AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) { } const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { + sys::SmartScopedLock Lock(*ALMutex); if (AttrList == RHS.AttrList) return *this; if (AttrList) AttrList->DropRef(); AttrList = RHS.AttrList;