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

David Blaikie dblaikie at gmail.com
Wed Jun 18 15:25:18 PDT 2014


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




More information about the llvm-commits mailing list