[llvm-dev] PassRegistry and multi-thread

Christophe Duvernois via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 18 04:41:31 PDT 2017


Hi,

The llvm documentation specify that :
"PassRegistry is NOT thread-safe. If you want to use LLVM on multiple
threads simultaneously, you will need to use a separate PassRegistry on
each thread."

I have some code that create a module, run some optimizations using the
llvm::legacy::FunctionPassManager and llvm::legacy::PassManager, and then
jit the code with an execution engine.
If I create my own PassRegistry and initialize pass like:

    PassRegistry* Registry = new llvm::PassRegistry();
    initializeCore(*Registry);
    ... etc ...


Using my passregistry, my program crash in :
llvm::PMTopLevelManager::schedulePass(llvm::Pass*)
const PassInfo *PI = findAnalysisPassInfo(*I); -> which is calling the
global PassRegistry

So how can I tell the FunctionPassManager to use my PassRegistry instead of
the global pass registry? What am I missing here?
Any help will be appreciated.

Regards,
Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170418/b1ea3a05/attachment.html>


More information about the llvm-dev mailing list