Add a lock() function in PassRegistry to speed up multi-thread synchronization.
authorErik Eckstein <eeckstein@apple.com>
Wed, 4 Mar 2015 18:57:11 +0000 (18:57 +0000)
committerErik Eckstein <eeckstein@apple.com>
Wed, 4 Mar 2015 18:57:11 +0000 (18:57 +0000)
commit953be88190e2937fa546a9adf01b90e5d362123e
tree7db1695d0e5fa7d6486f05a20097e539d224ad94
parentbe61f2b51c4ddde2c57de7328b39e403c86b7528
Add a lock() function in PassRegistry to speed up multi-thread synchronization.

When calling lock() after all passes are registered, the PassRegistry doesn't need a mutex anymore to look up passes.
This speeds up multithreaded llvm execution by ~5% (tested with 4 threads).
In an asserts build of llvm this has an even bigger impact.

Note that it's not required to use the lock function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231276 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/PassRegistry.h
lib/IR/PassRegistry.cpp