[PATCH] Replace debug mutexes with std::recursive_mutex.

Zachary Turner zturner at google.com
Wed Jun 18 15:34:38 PDT 2014


Less than the granularity of a thread quantum, if i recall.

Compiling the TU without the patch was between 1.97 and 2.03 seconds over a
couple of runs, and compiling with the patch was between 1.95 and 2.00
seconds over a couple of runs.


On Wed, Jun 18, 2014 at 3:25 PM, David Blaikie <dblaikie at gmail.com> wrote:

> On Wed, Jun 18, 2014 at 3:13 PM, Zachary Turner <zturner at google.com>
> wrote:
> > Hi chandlerc, dblaikie, rnk,
> >
> > This patch replaces all occurrences of SmartMutex<true> with an STL
> mutex.
> >
> > This introduces a minor behavioral change.  Previously, in situations
> where LLVM_ENABLE_THREADS was false, or where llvm_start_multithreaded()
> had not been called, SmartMutex<true> ended up a no-op.  With this change,
> a mutex will actually be acquired, even for single-threaded code.
> >
> > This has been discussed previously on the mailing list and there was
> some consensus that this was OK as the time required to acquire an
> uncontended mutex is extremely low on any sane mutex implementation, but
> I'm posting it again for wider review.  It's worth pointing out that a test
> compiling a very large TU with and without the patch shows no noticeable
> difference in wall-clock time.
>
> Rough estimate of the time, noise in measurement, etc?
>
> I might leave this for someone else who's got a better sense of perf
> analysis/timing/etc, ultimately.
>
> >
> > http://reviews.llvm.org/D4200
> >
> > Files:
> >   lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> >   lib/IR/LeakDetector.cpp
> >   lib/IR/LegacyPassManager.cpp
> >   lib/Support/DynamicLibrary.cpp
> >   lib/Support/PluginLoader.cpp
> >   lib/Support/Statistic.cpp
> >   lib/Support/Timer.cpp
> >   lib/Support/Windows/DynamicLibrary.inc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140618/f6113c79/attachment.html>


More information about the llvm-commits mailing list