[PATCH] D127778: [LTO][ELF] Add selective --save-temps= option
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 16:57:15 PDT 2022
MaskRay added a comment.
Ping on the llvm-lto2 change.
================
Comment at: lld/ELF/Config.h:215
bool relrPackDynRelocs = false;
- bool saveTemps;
+ llvm::SmallSet<std::string, 0> saveTempsArgs;
std::vector<std::pair<llvm::GlobPattern, uint32_t>> shuffleSections;
----------------
Use `llvm::DenseSet<StringRef>`.
SmallSet performs worse due to `std::set`.
================
Comment at: lld/ELF/Driver.cpp:1164
+ // --save-temps implies saving all temps.
+ config->saveTempsArgs.insert("resolution");
+ config->saveTempsArgs.insert("preopt");
----------------
Add `static const char *saveTempsValues[] = {...};`
Then append the values in `if (args.hasArg(OPT_save_temps)) {`
Below change `s == "resolution" || s == "preopt" || s == "postpromote"` to `llvm::is_contained(saveTempsValues, ...)`
================
Comment at: llvm/include/llvm/LTO/Config.h:18
#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/Config/llvm-config.h"
----------------
remove
================
Comment at: llvm/include/llvm/LTO/Config.h:273
+ bool UseInputModulePath = false,
+ const llvm::SmallSet<std::string, 0> &saveTempsArgs = {});
};
----------------
Use `llvm::DenseSet<StringRef>`.
================
Comment at: llvm/lib/LTO/LTOBackend.cpp:153
+ setHook("0.preopt", PreOptModuleHook);
+ if (saveTempsArgs.contains("postpromote"))
+ setHook("1.promote", PostPromoteModuleHook);
----------------
Shall we omit `post` from postinternalize,postimport,postopt so that the names match the temporary file names?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127778/new/
https://reviews.llvm.org/D127778
More information about the llvm-commits
mailing list