diff --git a/lld/test/ELF/lto/verify-invalid.ll b/lld/test/ELF/lto/verify-invalid.ll --- 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 @@ } ; -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 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -250,7 +250,9 @@ 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 @@ } 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,