1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[LTO] Remove options to disable inlining, vectorization & GVNLoadPRE.

This patch removes some ancient options as a clean-up before moving
code-gen to use LTOBackend in D94487.

I think it would preferable to remove those ancient options, because

  1. There are no corresponding options in LTOBackend based tools,
  2. There are no unit tests for them,
  3. They are not passed through by Clang,
  4. At least for GNVLoadPRE, users could just use GVN's `enable-load-pre`.

Alternatively we could add support for those options to lto::Config &
co, but I think it would be better to remove them, unless they are
actually used in practice.

Reviewed By: steven_wu, tejohnson

Differential Revision: https://reviews.llvm.org/D94783
This commit is contained in:
Florian Hahn 2021-01-16 16:28:05 +00:00
parent 321abb3244
commit c8b9f98090
4 changed files with 16 additions and 62 deletions

View File

@ -145,9 +145,7 @@ struct LTOCodeGenerator {
/// \note It is up to the linker to remove the intermediate output file. Do
/// not try to remove the object file in LTOCodeGenerator's destructor as we
/// don't who (LTOCodeGenerator or the output file) will last longer.
bool compile_to_file(const char **Name, bool DisableVerify,
bool DisableInline, bool DisableGVNLoadPRE,
bool DisableVectorization);
bool compile_to_file(const char **Name, bool DisableVerify);
/// As with compile_to_file(), this function compiles the merged module into
/// single output file. Instead of returning the output file path to the
@ -155,15 +153,12 @@ struct LTOCodeGenerator {
/// to the caller. This function should delete the intermediate file once
/// its content is brought to memory. Return NULL if the compilation was not
/// successful.
std::unique_ptr<MemoryBuffer> compile(bool DisableVerify, bool DisableInline,
bool DisableGVNLoadPRE,
bool DisableVectorization);
std::unique_ptr<MemoryBuffer> compile(bool DisableVerify);
/// Optimizes the merged module. Returns true on success.
///
/// Calls \a verifyMergedModuleOnce().
bool optimize(bool DisableVerify, bool DisableInline, bool DisableGVNLoadPRE,
bool DisableVectorization);
bool optimize(bool DisableVerify);
/// Compiles the merged optimized module into a single output file. It brings
/// the output to a buffer, and returns the buffer to the caller. Return NULL

View File

@ -326,22 +326,15 @@ LTOCodeGenerator::compileOptimized() {
return std::move(*BufferOrErr);
}
bool LTOCodeGenerator::compile_to_file(const char **Name, bool DisableVerify,
bool DisableInline,
bool DisableGVNLoadPRE,
bool DisableVectorization) {
if (!optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableVectorization))
bool LTOCodeGenerator::compile_to_file(const char **Name, bool DisableVerify) {
if (!optimize(DisableVerify))
return false;
return compileOptimizedToFile(Name);
}
std::unique_ptr<MemoryBuffer>
LTOCodeGenerator::compile(bool DisableVerify, bool DisableInline,
bool DisableGVNLoadPRE, bool DisableVectorization) {
if (!optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableVectorization))
std::unique_ptr<MemoryBuffer> LTOCodeGenerator::compile(bool DisableVerify) {
if (!optimize(DisableVerify))
return nullptr;
return compileOptimized();
@ -534,9 +527,7 @@ void LTOCodeGenerator::finishOptimizationRemarks() {
}
/// Optimize merged modules using various IPO passes
bool LTOCodeGenerator::optimize(bool DisableVerify, bool DisableInline,
bool DisableGVNLoadPRE,
bool DisableVectorization) {
bool LTOCodeGenerator::optimize(bool DisableVerify) {
if (!this->determineTarget())
return false;
@ -585,11 +576,9 @@ bool LTOCodeGenerator::optimize(bool DisableVerify, bool DisableInline,
Triple TargetTriple(TargetMach->getTargetTriple());
PassManagerBuilder PMB;
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
PMB.LoopVectorize = !DisableVectorization;
PMB.SLPVectorize = !DisableVectorization;
if (!DisableInline)
PMB.Inliner = createFunctionInliningPass();
PMB.LoopVectorize = true;
PMB.SLPVectorize = true;
PMB.Inliner = createFunctionInliningPass();
PMB.LibraryInfo = new TargetLibraryInfoImpl(TargetTriple);
if (Freestanding)
PMB.LibraryInfo->disableAllFunctions();

View File

@ -78,17 +78,6 @@ static cl::opt<bool> DisableVerify(
"disable-verify", cl::init(false),
cl::desc("Do not run the verifier during the optimization pipeline"));
static cl::opt<bool> DisableInline("disable-inlining", cl::init(false),
cl::desc("Do not run the inliner pass"));
static cl::opt<bool>
DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false),
cl::desc("Do not run the GVN load PRE pass"));
static cl::opt<bool> DisableLTOVectorization(
"disable-lto-vectorization", cl::init(false),
cl::desc("Do not run loop or slp vectorization during LTO"));
static cl::opt<bool> EnableFreestanding(
"lto-freestanding", cl::init(false),
cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
@ -1042,8 +1031,7 @@ int main(int argc, char **argv) {
error("writing linked module failed.");
}
if (!CodeGen.optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableLTOVectorization)) {
if (!CodeGen.optimize(DisableVerify)) {
// Diagnostic messages should have been printed by the handler.
error("error optimizing the code");
}
@ -1084,8 +1072,7 @@ int main(int argc, char **argv) {
error(": -save-merged-module must be specified with -o");
const char *OutputName = nullptr;
if (!CodeGen.compile_to_file(&OutputName, DisableVerify, DisableInline,
DisableGVNLoadPRE, DisableLTOVectorization))
if (!CodeGen.compile_to_file(&OutputName, DisableVerify))
error("error compiling the code");
// Diagnostic messages should have been printed by the handler.

View File

@ -41,18 +41,6 @@ OptLevel("O",
cl::ZeroOrMore,
cl::init('2'));
static cl::opt<bool>
DisableInline("disable-inlining", cl::init(false),
cl::desc("Do not run the inliner pass"));
static cl::opt<bool>
DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false),
cl::desc("Do not run the GVN load PRE pass"));
static cl::opt<bool> DisableLTOVectorization(
"disable-lto-vectorization", cl::init(false),
cl::desc("Do not run loop or slp vectorization during LTO"));
static cl::opt<bool> EnableFreestanding(
"lto-freestanding", cl::init(false),
cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
@ -448,9 +436,7 @@ bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) {
maybeParseOptions(cg);
LibLTOCodeGenerator *CG = unwrap(cg);
CG->NativeObjectFile =
CG->compile(DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableLTOVectorization);
CG->NativeObjectFile = CG->compile(DisableVerify);
if (!CG->NativeObjectFile)
return nullptr;
*length = CG->NativeObjectFile->getBufferSize();
@ -459,8 +445,7 @@ const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) {
bool lto_codegen_optimize(lto_code_gen_t cg) {
maybeParseOptions(cg);
return !unwrap(cg)->optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableLTOVectorization);
return !unwrap(cg)->optimize(DisableVerify);
}
const void *lto_codegen_compile_optimized(lto_code_gen_t cg, size_t *length) {
@ -475,9 +460,7 @@ const void *lto_codegen_compile_optimized(lto_code_gen_t cg, size_t *length) {
bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
maybeParseOptions(cg);
return !unwrap(cg)->compile_to_file(
name, DisableVerify, DisableInline, DisableGVNLoadPRE,
DisableLTOVectorization);
return !unwrap(cg)->compile_to_file(name, DisableVerify);
}
void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) {