[PATCH] D98183: [libLTO] Add support for -save-temps.
Qiongsi Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 23 13:34:24 PDT 2023
qiongsiwu1 updated this revision to Diff 534062.
qiongsiwu1 added a comment.
Moving https://reviews.llvm.org/D153559 over to this patch. This update is simply a rebase. I will look into consolidating the options between thin and regular LTO's interface next.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98183/new/
https://reviews.llvm.org/D98183
Files:
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
Index: llvm/tools/llvm-lto2/llvm-lto2.cpp
===================================================================
--- llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -63,8 +63,9 @@
static cl::opt<std::string> AAPipeline("aa-pipeline",
cl::desc("Alias Analysis Pipeline"),
cl::value_desc("aapipeline"));
-
-static cl::opt<bool> SaveTemps("save-temps", cl::desc("Save temporary files"));
+namespace llvm {
+extern cl::opt<bool> SaveTemps;
+}
static cl::list<std::string> SelectSaveTemps(
"select-save-temps",
Index: llvm/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -127,6 +127,10 @@
cl::opt<std::string>
LTOCSIRProfile("cs-profile-path",
cl::desc("Context sensitive profile file path"));
+
+cl::opt<bool> SaveTemps(
+ "save-temps", cl::init(false),
+ cl::desc("Save temporary LTO files in the current working directory."));
} // namespace llvm
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
@@ -623,6 +627,9 @@
// Add an appropriate DataLayout instance for this module...
MergedModule->setDataLayout(TargetMach->createDataLayout());
+ if (Config.PostImportModuleHook)
+ Config.PostImportModuleHook(0, *MergedModule);
+
if (!SaveIRBeforeOptPath.empty()) {
std::error_code EC;
raw_fd_ostream OS(SaveIRBeforeOptPath, EC, sys::fs::OF_None);
@@ -688,6 +695,12 @@
void LTOCodeGenerator::parseCodeGenDebugOptions() {
if (!CodegenOptions.empty())
llvm::parseCommandLineOptions(CodegenOptions);
+
+ if (SaveTemps) {
+ if (Config.addSaveTemps("ld-temp.",
+ /* UseInputModulePath */ true))
+ errs() << "Warning: failed to set up path to save temporary files\n";
+ }
}
void llvm::parseCommandLineOptions(std::vector<std::string> &Options) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98183.534062.patch
Type: text/x-patch
Size: 1994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230623/e72d0af5/attachment.bin>
More information about the llvm-commits
mailing list