<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94154>94154</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Is PassRegistry still not thread-safe?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
falhumai96
</td>
</tr>
</table>
<pre>
https://llvm.org/doxygen/classllvm_1_1PassRegistry.html#details
I'm looking at the details for this class, and I saw a note saying that this class is not thread-safe. However, looking at the class declaration in the headr file in private member fields and also looking at the .CPP file for the implementation, I noticed that all methods are being locked by a reader-writer lock. So, is the note outdated or does it still hold that statement?
The .CPP implementation for LLVM 19: https://llvm.org/doxygen/PassRegistry_8cpp_source.html for reference.
Also, speaking of which, I have a question regarding LLVM initialization (which internally they call PassRegistry). I understand that llvm initialization functions (e.g. initializeNativeTarget) must be called before any other llvm functions (e.g. JIT related code) and I understand that they can be called multiple times by the calling clients, but are the initialization functions thread-safe themselves? Meaning, can two threads call these functions safely, or are they only allowed to be called by one parent thread (e.g. the main thread)?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGO4zYM_RrlQozhyJ7J-uDDdBdBU-wWg3bQ64C2aFtdWUpFOqn79YWUTDebokAviSGSj49Pj0JmO3qiVj3-oB4_bXCRKcR2QDctM9rmadMFs7aTyJFV9az0Xum9c6e5CHFUem_Cn-tIXul975A5Rd62b9sXZP6FRssS12KS2SldGRK0jlX5SZXPl9-D0rsZXAhfrR8BBWQiuObBECLIZBkystIfAb2BAzCeAcEHIWBcU6FMufQ9FSynMMgUCc0D40AF_BjOdKKYYO76XWoM9Q4jig0erM-BidBEGKyjdHKM9oRCMNPcUTomZzhTQsfhHrT4-PJyKb2MQWDno6OZvOQeicchsbQ9mcsA6BzMJFNIsJGgo4TnQv-VDHQrIKRxKD6coxWKOVLAryFBWc49sihhEYNCBkIEE4jBCrB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