mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[ThinLTO] The "codegen only" path didn't honor the recently added file-based API
llvm-svn: 292667
This commit is contained in:
parent
9e1b62af44
commit
e74b013127
@ -829,11 +829,22 @@ static std::string writeGeneratedObject(int count, StringRef CacheEntryPath,
|
||||
|
||||
// Main entry point for the ThinLTO processing
|
||||
void ThinLTOCodeGenerator::run() {
|
||||
// Prepare the resulting object vector
|
||||
assert(ProducedBinaries.empty() && "The generator should not be reused");
|
||||
if (SavedObjectsDirectoryPath.empty())
|
||||
ProducedBinaries.resize(Modules.size());
|
||||
else {
|
||||
sys::fs::create_directories(SavedObjectsDirectoryPath);
|
||||
bool IsDir;
|
||||
sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir);
|
||||
if (!IsDir)
|
||||
report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'");
|
||||
ProducedBinaryFiles.resize(Modules.size());
|
||||
}
|
||||
|
||||
if (CodeGenOnly) {
|
||||
// Perform only parallel codegen and return.
|
||||
ThreadPool Pool;
|
||||
assert(ProducedBinaries.empty() && "The generator should not be reused");
|
||||
ProducedBinaries.resize(Modules.size());
|
||||
int count = 0;
|
||||
for (auto &ModuleBuffer : Modules) {
|
||||
Pool.async([&](int count) {
|
||||
@ -845,7 +856,12 @@ void ThinLTOCodeGenerator::run() {
|
||||
/*IsImporting*/ false);
|
||||
|
||||
// CodeGen
|
||||
ProducedBinaries[count] = codegen(*TheModule);
|
||||
auto OutputBuffer = codegen(*TheModule);
|
||||
if (SavedObjectsDirectoryPath.empty())
|
||||
ProducedBinaries[count] = std::move(OutputBuffer);
|
||||
else
|
||||
ProducedBinaryFiles[count] = writeGeneratedObject(
|
||||
count, "", SavedObjectsDirectoryPath, *OutputBuffer);
|
||||
}, count++);
|
||||
}
|
||||
|
||||
@ -866,18 +882,6 @@ void ThinLTOCodeGenerator::run() {
|
||||
WriteIndexToFile(*Index, OS);
|
||||
}
|
||||
|
||||
// Prepare the resulting object vector
|
||||
assert(ProducedBinaries.empty() && "The generator should not be reused");
|
||||
if (SavedObjectsDirectoryPath.empty())
|
||||
ProducedBinaries.resize(Modules.size());
|
||||
else {
|
||||
sys::fs::create_directories(SavedObjectsDirectoryPath);
|
||||
bool IsDir;
|
||||
sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir);
|
||||
if (!IsDir)
|
||||
report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'");
|
||||
ProducedBinaryFiles.resize(Modules.size());
|
||||
}
|
||||
|
||||
// Prepare the module map.
|
||||
auto ModuleMap = generateModuleMap(Modules);
|
||||
|
Loading…
Reference in New Issue
Block a user