[llvm] r247824 - Disable the second verification run when performing LTO through

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 11:06:45 PDT 2015


Author: tejohnson
Date: Wed Sep 16 13:06:45 2015
New Revision: 247824

URL: http://llvm.org/viewvc/llvm-project?rev=247824&view=rev
Log:
Disable the second verification run when performing LTO through
gold in NDEBUG mode.
Follow on patch for r247729 - LTO: Disable extra verify runs in release
builds.

Added:
    llvm/trunk/test/tools/gold/X86/disable-verify.ll
Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Added: llvm/trunk/test/tools/gold/X86/disable-verify.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/disable-verify.ll?rev=247824&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/disable-verify.ll (added)
+++ llvm/trunk/test/tools/gold/X86/disable-verify.ll Wed Sep 16 13:06:45 2015
@@ -0,0 +1,25 @@
+; RUN: llvm-as %s -o %t.o
+; REQUIRES: asserts
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=disable-verify \
+; RUN:    --plugin-opt=-debug-pass=Arguments \
+; RUN:    -shared %t.o -o %t2.o 2>&1 | FileCheck %s
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=-debug-pass=Arguments \
+; RUN:    -shared %t.o -o %t2.o 2>&1 | FileCheck %s -check-prefix=VERIFY
+
+target triple = "x86_64-unknown-linux-gnu"
+
+; -disable-verify should disable output verification from the optimization
+; pipeline.
+; CHECK: Pass Arguments: {{.*}} -verify -ipsccp
+; CHECK-NOT: -verify
+
+; VERIFY: Pass Arguments: {{.*}} -verify {{.*}} -verify
+
+define void @f() {
+entry:
+  ret void
+}

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=247824&r1=247823&r2=247824&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Sep 16 13:06:45 2015
@@ -94,6 +94,11 @@ namespace options {
   static OutputType TheOutputType = OT_NORMAL;
   static unsigned OptLevel = 2;
   static unsigned Parallelism = 1;
+#ifdef NDEBUG
+  static bool DisableVerify = true;
+#else
+  static bool DisableVerify = false;
+#endif
   static std::string obj_path;
   static std::string extra_library_path;
   static std::string triple;
@@ -134,6 +139,8 @@ namespace options {
     } else if (opt.startswith("jobs=")) {
       if (StringRef(opt_ + 5).getAsInteger(10, Parallelism))
         message(LDPL_FATAL, "Invalid parallelism level: %s", opt_ + 5);
+    } else if (opt == "disable-verify") {
+      DisableVerify = true;
     } else {
       // Save this option to pass to the code generator.
       // ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -730,8 +737,10 @@ static void runLTOPasses(Module &M, Targ
   PassManagerBuilder PMB;
   PMB.LibraryInfo = new TargetLibraryInfoImpl(Triple(TM.getTargetTriple()));
   PMB.Inliner = createFunctionInliningPass();
+  // Unconditionally verify input since it is not verified before this
+  // point and has unknown origin.
   PMB.VerifyInput = true;
-  PMB.VerifyOutput = true;
+  PMB.VerifyOutput = !options::DisableVerify;
   PMB.LoopVectorize = true;
   PMB.SLPVectorize = true;
   PMB.OptLevel = options::OptLevel;




More information about the llvm-commits mailing list