[llvm-branch-commits] [lld] 26d3aae - [LTO][NewPM] Run verifier when doing LTO
Arthur Eubanks via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 1 12:09:37 PST 2020
Author: Arthur Eubanks
Date: 2020-12-01T10:14:53-08:00
New Revision: 26d3aaeb3aac39329dd845bd0012ad961653dbc6
URL: https://github.com/llvm/llvm-project/commit/26d3aaeb3aac39329dd845bd0012ad961653dbc6
DIFF: https://github.com/llvm/llvm-project/commit/26d3aaeb3aac39329dd845bd0012ad961653dbc6.diff
LOG: [LTO][NewPM] Run verifier when doing LTO
This matches the legacy PM.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D92138
Added:
Modified:
lld/test/ELF/lto/verify-invalid.ll
llvm/lib/LTO/LTOBackend.cpp
Removed:
################################################################################
diff --git a/lld/test/ELF/lto/verify-invalid.ll b/lld/test/ELF/lto/verify-invalid.ll
index d44c483dbcbb..c18c264ef632 100644
--- a/lld/test/ELF/lto/verify-invalid.ll
+++ b/lld/test/ELF/lto/verify-invalid.ll
@@ -1,11 +1,17 @@
; REQUIRES: x86
; RUN: llvm-as %s -o %t.o
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments \
-; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT %s
+; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-LPM %s
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments \
-; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE %s
+; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments \
-; RUN: --plugin-opt=disable-verify 2>&1 | FileCheck -check-prefix=DISABLE %s
+; RUN: --plugin-opt=disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s
+; RUN: ld.lld %t.o -o %t2 --lto-new-pass-manager --lto-debug-pass-manager \
+; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-NPM %s
+; RUN: ld.lld %t.o -o %t2 --lto-new-pass-manager --lto-debug-pass-manager \
+; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-NPM %s
+; RUN: ld.lld %t.o -o %t2 --lto-new-pass-manager --lto-debug-pass-manager \
+; RUN: --plugin-opt=disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-NPM %s
target triple = "x86_64-unknown-linux-gnu"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
@@ -15,5 +21,9 @@ define void @_start() {
}
; -disable-verify should disable the verification of bitcode.
-; DEFAULT: Pass Arguments: {{.*}} -verify {{.*}} -verify
-; DISABLE-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify
+; DEFAULT-LPM: Pass Arguments: {{.*}} -verify {{.*}} -verify
+; DISABLE-LPM-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify
+; DEFAULT-NPM: Running pass: VerifierPass
+; DEFAULT-NPM: Running pass: VerifierPass
+; DEFAULT-NPM-NOT: Running pass: VerifierPass
+; DISABLE-NPM-NOT: Running pass: VerifierPass
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 3f082fdeea5b..65aaa8d21bfc 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -250,7 +250,9 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
ModulePassManager MPM(Conf.DebugPassManager);
- // FIXME (davide): verify the input.
+
+ if (!Conf.DisableVerify)
+ MPM.addPass(VerifierPass());
PassBuilder::OptimizationLevel OL;
@@ -272,12 +274,14 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
}
if (IsThinLTO)
- MPM = PB.buildThinLTODefaultPipeline(OL, ImportSummary);
+ MPM.addPass(PB.buildThinLTODefaultPipeline(OL, ImportSummary));
else
- MPM = PB.buildLTODefaultPipeline(OL, ExportSummary);
- MPM.run(Mod, MAM);
+ MPM.addPass(PB.buildLTODefaultPipeline(OL, ExportSummary));
- // FIXME (davide): verify the output.
+ if (!Conf.DisableVerify)
+ MPM.addPass(VerifierPass());
+
+ MPM.run(Mod, MAM);
}
static void runNewPMCustomPasses(const Config &Conf, Module &Mod,
More information about the llvm-branch-commits
mailing list