diff options
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 8 | ||||
-rw-r--r-- | llvm/tools/lto/lto.cpp | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index cdb1bcaa6bc..50680ccb8ab 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -36,6 +36,10 @@ OptLevel("O", cl::ZeroOrMore, cl::init('2')); +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")); @@ -248,7 +252,7 @@ int main(int argc, char **argv) { if (!OutputFilename.empty()) { std::string ErrorInfo; - if (!CodeGen.optimize(DisableInline, DisableGVNLoadPRE, + if (!CodeGen.optimize(DisableVerify, DisableInline, DisableGVNLoadPRE, DisableLTOVectorization, ErrorInfo)) { errs() << argv[0] << ": error optimizing the code: " << ErrorInfo << "\n"; return 1; @@ -285,7 +289,7 @@ int main(int argc, char **argv) { std::string ErrorInfo; const char *OutputName = nullptr; - if (!CodeGen.compile_to_file(&OutputName, DisableInline, + if (!CodeGen.compile_to_file(&OutputName, DisableVerify, DisableInline, DisableGVNLoadPRE, DisableLTOVectorization, ErrorInfo)) { errs() << argv[0] diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index 8f62929b326..62675081464 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -43,6 +43,16 @@ static cl::opt<bool> DisableLTOVectorization("disable-lto-vectorization", cl::init(false), cl::desc("Do not run loop or slp vectorization during LTO")); +#ifdef NDEBUG +static bool VerifyByDefault = false; +#else +static bool VerifyByDefault = true; +#endif + +static cl::opt<bool> DisableVerify( + "disable-llvm-verifier", cl::init(!VerifyByDefault), + cl::desc("Don't run the LLVM verifier during the optimization pipeline")); + // Holds most recent error string. // *** Not thread safe *** static std::string sLastErrorString; @@ -321,8 +331,9 @@ 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(DisableInline, DisableGVNLoadPRE, - DisableLTOVectorization, sLastErrorString); + CG->NativeObjectFile = + CG->compile(DisableVerify, DisableInline, DisableGVNLoadPRE, + DisableLTOVectorization, sLastErrorString); if (!CG->NativeObjectFile) return nullptr; *length = CG->NativeObjectFile->getBufferSize(); @@ -331,9 +342,8 @@ 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(DisableInline, - DisableGVNLoadPRE, DisableLTOVectorization, - sLastErrorString); + return !unwrap(cg)->optimize(DisableVerify, DisableInline, DisableGVNLoadPRE, + DisableLTOVectorization, sLastErrorString); } const void *lto_codegen_compile_optimized(lto_code_gen_t cg, size_t *length) { @@ -349,7 +359,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, DisableInline, DisableGVNLoadPRE, + name, DisableVerify, DisableInline, DisableGVNLoadPRE, DisableLTOVectorization, sLastErrorString); } |