diff --git a/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h --- a/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h +++ b/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h @@ -145,9 +145,7 @@ /// \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 @@ /// 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 compile(bool DisableVerify, bool DisableInline, - bool DisableGVNLoadPRE, - bool DisableVectorization); + std::unique_ptr 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 diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -326,22 +326,15 @@ 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 -LTOCodeGenerator::compile(bool DisableVerify, bool DisableInline, - bool DisableGVNLoadPRE, bool DisableVectorization) { - if (!optimize(DisableVerify, DisableInline, DisableGVNLoadPRE, - DisableVectorization)) +std::unique_ptr LTOCodeGenerator::compile(bool DisableVerify) { + if (!optimize(DisableVerify)) return nullptr; return compileOptimized(); @@ -534,9 +527,7 @@ } /// 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 @@ 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(); diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -78,17 +78,6 @@ "disable-verify", cl::init(false), cl::desc("Do not run the verifier during the optimization pipeline")); -static cl::opt DisableInline("disable-inlining", cl::init(false), - cl::desc("Do not run the inliner pass")); - -static cl::opt - DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), - cl::desc("Do not run the GVN load PRE pass")); - -static cl::opt DisableLTOVectorization( - "disable-lto-vectorization", cl::init(false), - cl::desc("Do not run loop or slp vectorization during LTO")); - static cl::opt EnableFreestanding( "lto-freestanding", cl::init(false), cl::desc("Enable Freestanding (disable builtins / TLI) during LTO")); @@ -1042,8 +1031,7 @@ 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 @@ 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. diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -41,18 +41,6 @@ cl::ZeroOrMore, cl::init('2')); -static cl::opt -DisableInline("disable-inlining", cl::init(false), - cl::desc("Do not run the inliner pass")); - -static cl::opt -DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), - cl::desc("Do not run the GVN load PRE pass")); - -static cl::opt DisableLTOVectorization( - "disable-lto-vectorization", cl::init(false), - cl::desc("Do not run loop or slp vectorization during LTO")); - static cl::opt EnableFreestanding( "lto-freestanding", cl::init(false), cl::desc("Enable Freestanding (disable builtins / TLI) during LTO")); @@ -448,9 +436,7 @@ 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 @@ 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 @@ 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) {