[llvm-dev] Multi-Threading Compilers
Florian Hahn via llvm-dev
llvm-dev at lists.llvm.org
Thu Mar 26 04:25:50 PDT 2020
> On Mar 26, 2020, at 11:09, David Chisnall via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> On 26/03/2020 11:06, Florian Hahn via llvm-dev wrote:
>> One problem is that function passes can add new global, e.g. new declarations if they introduce new calls. I guess that would require some locking, but should happen quite infrequently.
> Can they? I have had to make a pass a ModulePass in the past, because it added a global to hold a cache. The global was used in only the function being modified, but the fact that it was a global prevented the pass from being a FunctionPass.
Maybe they should not, but I think in practice plenty of function passes insert new declarations.
For example, I think Intrinsic::getDeclaration inserts a new declaration if the requested intrinsic is not yet declared (https://github.com/llvm/llvm-project/blob/master/llvm/lib/IR/Function.cpp#L1117) and a lot of function passes use it.
More information about the llvm-dev