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
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"));
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;
}