[llvm-dev] Multi-Threading Compilers

Johannes Doerfert via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 00:03:31 PDT 2020


On 3/26/20 6:25 AM, Florian Hahn via llvm-dev wrote:
 >
 >
 >> 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.

I think you are unfortunately both correct. As I said before, creating,
modifying, and deleting globals will most likely need explicit
synchronization. It is not too hard to implement though and unlikely to
be a performance bottleneck (IMHO).

Cheers,
   Johannes

 > Cheers,
 > Florian
 > _______________________________________________
 > LLVM Developers mailing list
 > llvm-dev at lists.llvm.org
 > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list