diff --git a/lld/MachO/Config.h b/lld/MachO/Config.h index f8dcc84e4ee1b..1752f4ef3406e 100644 --- a/lld/MachO/Config.h +++ b/lld/MachO/Config.h @@ -219,6 +219,7 @@ struct Configuration { llvm::StringRef csProfilePath; bool pgoWarnMismatch; bool warnThinArchiveMissingMembers; + bool disableVerify; bool callGraphProfileSort = false; llvm::StringRef printSymbolOrder; diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 4f6c9b4ddc798..ee26fafb50b73 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -1832,6 +1832,7 @@ bool link(ArrayRef argsArr, llvm::raw_ostream &stdoutOS, args.hasFlag(OPT_warn_thin_archive_missing_members, OPT_no_warn_thin_archive_missing_members, true); config->generateUuid = !args.hasArg(OPT_no_uuid); + config->disableVerify = args.hasArg(OPT_disable_verify); auto IncompatWithCGSort = [&](StringRef firstArgStr) { // Throw an error only if --call-graph-profile-sort is explicitly specified diff --git a/lld/MachO/LTO.cpp b/lld/MachO/LTO.cpp index 2eeca44ecbb3c..075faa8801a54 100644 --- a/lld/MachO/LTO.cpp +++ b/lld/MachO/LTO.cpp @@ -60,6 +60,7 @@ static lto::Config createConfig() { c.CSIRProfile = std::string(config->csProfilePath); c.RunCSIRInstr = config->csProfileGenerate; c.PGOWarnMismatch = config->pgoWarnMismatch; + c.DisableVerify = config->disableVerify; c.OptLevel = config->ltoo; c.CGOptLevel = config->ltoCgo; if (config->saveTemps) diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td index 9001e85582c12..9179ae2d1812e 100644 --- a/lld/MachO/Options.td +++ b/lld/MachO/Options.td @@ -100,6 +100,9 @@ def lto_CGO: Joined<["--"], "lto-CGO">, HelpText<"Set codegen optimization level for LTO (default: 2)">, MetaVarName<"">, Group; +def disable_verify : Flag<["--"], "disable_verify">, + HelpText<"Do not verify LLVM modules during LTO">, + Group; def thinlto_cache_policy_eq: Joined<["--"], "thinlto-cache-policy=">, HelpText<"Pruning policy for the ThinLTO cache">, Group; diff --git a/lld/test/MachO/verify.ll b/lld/test/MachO/verify.ll new file mode 100644 index 0000000000000..8731c99c2ca14 --- /dev/null +++ b/lld/test/MachO/verify.ll @@ -0,0 +1,16 @@ +; REQUIRES: x86 + +; RUN: llvm-as %s -o %t.o +; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager 2>&1 | FileCheck %s --check-prefix=VERIFY +; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager --disable_verify 2>&1 | FileCheck %s --implicit-check-not=VerifierPass + +target triple = "x86_64-apple-darwin" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { +entry: + ret void +} + +; VERIFY: Running pass: VerifierPass +; VERIFY: Running pass: VerifierPass