-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld][MachO] Add --disable_verify flag #132105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lld-macho @llvm/pr-subscribers-lld Author: Ellis Hoag (ellishg) ChangesThe llvm-project/lld/ELF/Options.td Line 661 in 93afd8f
This allows us to quickly suppress verification errors. Full diff: https://github.com/llvm/llvm-project/pull/132105.diff 5 Files Affected:
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<const char *> 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..0f78c3bbe2b06 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -197,6 +197,9 @@ def cs_profile_generate: Flag<["--"], "cs-profile-generate">,
HelpText<"Perform context sensitive PGO instrumentation">, Group<grp_lld>;
def cs_profile_path: Joined<["--"], "cs-profile-path=">,
HelpText<"Context sensitive profile file path">, Group<grp_lld>;
+def disable_verify : Flag<["--"], "disable_verify">,
+ HelpText<"Do not verify LLVM modules">,
+ Group<grp_lld>;
defm pgo_warn_mismatch: BB<"pgo-warn-mismatch",
"turn on warnings about profile cfg mismatch (default)",
"turn off warnings about profile cfg mismatch">, Group<grp_lld>;
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
|
lld/MachO/Options.td
Outdated
@@ -197,6 +197,9 @@ def cs_profile_generate: Flag<["--"], "cs-profile-generate">, | |||
HelpText<"Perform context sensitive PGO instrumentation">, Group<grp_lld>; | |||
def cs_profile_path: Joined<["--"], "cs-profile-path=">, | |||
HelpText<"Context sensitive profile file path">, Group<grp_lld>; | |||
def disable_verify : Flag<["--"], "disable_verify">, | |||
HelpText<"Do not verify LLVM modules">, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit : would be good to move this flag around other LTO-specific flags. Ex: lto_CGO
.
Also maybe help text could show this is LTO related. Ex "Do not verify LLVM modules during LTO"
The
--disable_verify
flag is implemented for ELF and is used to disable LLVM module verification.llvm-project/lld/ELF/Options.td
Line 661 in 93afd8f
This allows us to quickly suppress verification errors.