[llvm] [Backend] Add clearSubtargetMap API for TargetMachine. (PR #112383)

weiwei chen via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 11:11:11 PDT 2024


weiweichen wrote:

> > To parallelize llvm compilation for more efficient compilation time.
> 
> But I would expect you can use one machine for different compilations. Is the issue TargetOptions?

Not exactly. It's the that `TargetMachine` (like LLVMContext and MCContext) cannot be shared among parallel llc pipelines because it's not read-only and not thread-safe. `SubtargetInfo` is part of `TargetMachine` (or rather `LLVMTargetMachine`), it is a StringMap to dedup those can be shared among MachineFunctions that uses the same `TargetMachine`, but not when there are multiple `TargetMachine`s. This is not mainly a functionality issue but memory footprint during compilation time and can potentially reduced where there are many parallel pipelines running. 

https://github.com/llvm/llvm-project/pull/112383


More information about the llvm-commits mailing list