[PATCH] Add a lock() function in PassRegistry to speed up multi-thread synchronization.

Mehdi Amini mehdi.amini at apple.com
Fri Feb 27 08:30:36 PST 2015


> On Feb 27, 2015, at 8:05 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> On Feb 27, 2015 7:52 AM, "Mehdi AMINI" <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote:
> >
> > ================
> > Comment at: lib/IR/PassRegistry.cpp:52
> > @@ +51,3 @@
> > +  if (needMutex)
> > +    Lock.unlock_shared();
> > +  return PI;
> > ----------------
> > It is unfortunate to lose RAII, is there a good reason why SmartScopedReader cannot take an extra parameter to be constructed without locking? (like std::unique_lock())
> 
> (Agreed, and I provided a patch in my last reply that keeps RAII)
> 
> 


I missed the fact we have Optional in LLVM! 
Nice workaround for the lack of optional locking in SmartScopedReader. 

Erik, can you adopt this and update you patch?

Thanks,

— 
Mehdi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150227/d0a5f123/attachment.html>


More information about the llvm-commits mailing list