mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Reduce memory usage by freeing memory occupied by SILModules after IRGen.
There is no need to keep SILModules around after IRGen has generated LLVM IR from them. This reduces the compiler memory usage during LLVM code-generation and optimization phases roughly by 15%-20%.
This commit is contained in:
@@ -1073,10 +1073,10 @@ static bool performCompile(CompilerInstance &Instance,
|
||||
// something is persisting across calls to performIRGeneration.
|
||||
auto &LLVMContext = getGlobalLLVMContext();
|
||||
if (PrimarySourceFile) {
|
||||
performIRGeneration(IRGenOpts, *PrimarySourceFile, SM.get(),
|
||||
performIRGeneration(IRGenOpts, *PrimarySourceFile, std::move(SM),
|
||||
opts.getSingleOutputFilename(), LLVMContext);
|
||||
} else {
|
||||
performIRGeneration(IRGenOpts, Instance.getMainModule(), SM.get(),
|
||||
performIRGeneration(IRGenOpts, Instance.getMainModule(), std::move(SM),
|
||||
opts.getSingleOutputFilename(), LLVMContext);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user