mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-01 07:09:02 +00:00
llvm-lto: add a -thinlto-module-id that enables to force the Module identifier.
ThinLTO is using the Module Identifier to find the corresponding entry in the index. However when reproducing part of the flow from temporary files generated from the linker, you'd like to process a file and force llvm-lto to use another module identifier than the current filename. The alternative would be to tweak the index, which would be more involved. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af542d8d9a
commit
3d13068cfd
@ -101,6 +101,11 @@ static cl::opt<std::string>
|
||||
cl::desc("Provide the index produced by a ThinLink, required "
|
||||
"to perform the promotion and/or importing."));
|
||||
|
||||
static cl::opt<std::string> ThinLTOModuleId(
|
||||
"thinlto-module-id",
|
||||
cl::desc("For the module ID for the file to process, useful to "
|
||||
"match what is in the index."));
|
||||
|
||||
static cl::opt<bool>
|
||||
SaveModuleFile("save-merged-module", cl::init(false),
|
||||
cl::desc("Write merged LTO module to file before CodeGen"));
|
||||
@ -318,6 +323,12 @@ static std::unique_ptr<Module> loadModule(StringRef Filename,
|
||||
report_fatal_error("Can't load module for file " + Filename);
|
||||
}
|
||||
maybeVerifyModule(*M);
|
||||
|
||||
if (ThinLTOModuleId.getNumOccurrences()) {
|
||||
if (InputFilenames.size() != 1)
|
||||
report_fatal_error("Can't override the module id for multiple files");
|
||||
M->setModuleIdentifier(ThinLTOModuleId);
|
||||
}
|
||||
return M;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user