[PATCH] D92138: [LTO][NewPM] Run verifier when doing LTO

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 14:52:44 PST 2020


aeubanks created this revision.
aeubanks added reviewers: asbirlea, ychen.
Herald added subscribers: llvm-commits, steven_wu, hiraditya, inglorion, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
aeubanks requested review of this revision.
Herald added a subscriber: MaskRay.

This matches the legacy PM.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92138

Files:
  lld/test/ELF/lto/verify-invalid.ll
  llvm/lib/LTO/LTOBackend.cpp


Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ 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,
Index: lld/test/ELF/lto/verify-invalid.ll
===================================================================
--- lld/test/ELF/lto/verify-invalid.ll
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92138.307717.patch
Type: text/x-patch
Size: 2906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201125/226cf63f/attachment.bin>


More information about the llvm-commits mailing list