[llvm-branch-commits] [lld] 68ff3b3 - [LLD][gold] Add -plugin-opt=no-new-pass-manager

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 9 13:35:06 PST 2020


Author: Fangrui Song
Date: 2020-12-09T13:31:03-08:00
New Revision: 68ff3b3376f4242307a36ac035a512ec4e256628

URL: https://github.com/llvm/llvm-project/commit/68ff3b3376f4242307a36ac035a512ec4e256628
DIFF: https://github.com/llvm/llvm-project/commit/68ff3b3376f4242307a36ac035a512ec4e256628.diff

LOG: [LLD][gold] Add -plugin-opt=no-new-pass-manager

-DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=on configured LLD and LLVMgold.so
will use the new pass manager by default. Add an option to
use the legacy pass manager. This will also be used by the Clang driver
when -fno-new-pass-manager (D92915) / -fno-experimental-new-pass-manager is set.

Reviewed By: aeubanks, tejohnson

Differential Revision: https://reviews.llvm.org/D92916

Added: 
    

Modified: 
    lld/ELF/Options.td
    lld/test/ELF/lto/new-pass-manager.ll
    llvm/test/tools/gold/X86/new-pm.ll
    llvm/tools/gold/gold-plugin.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 0254b54eca1d8..c79578ce18fa5 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -598,6 +598,8 @@ def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for
 def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
 def: F<"plugin-opt=new-pass-manager">,
   Alias<lto_new_pass_manager>, HelpText<"Alias for --lto-new-pass-manager">;
+def: F<"plugin-opt=no-new-pass-manager">,
+  Alias<no_lto_new_pass_manager>, HelpText<"Alias for --no-lto-new-pass-manager">;
 def: F<"plugin-opt=cs-profile-generate">,
   Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">;
 def: J<"plugin-opt=cs-profile-path=">,

diff  --git a/lld/test/ELF/lto/new-pass-manager.ll b/lld/test/ELF/lto/new-pass-manager.ll
index 941235b486307..6b6f6ce83cf00 100644
--- a/lld/test/ELF/lto/new-pass-manager.ll
+++ b/lld/test/ELF/lto/new-pass-manager.ll
@@ -7,6 +7,7 @@
 ; RUN: ld.lld --lto-new-pass-manager --plugin-opt=debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
 ; RUN: ld.lld --lto-new-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
 ; RUN: ld.lld --lto-new-pass-manager --no-lto-new-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s --check-prefix=LEGACY
+; RUN: ld.lld --plugin-opt=no-new-pass-manager --plugin-opt=debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s --check-prefix=LEGACY
 
 ; CHECK: Starting llvm::Module pass manager run
 ; CHECK: Finished llvm::Module pass manager run

diff  --git a/llvm/test/tools/gold/X86/new-pm.ll b/llvm/test/tools/gold/X86/new-pm.ll
index ee5e6ed53b135..05c7883b1403f 100644
--- a/llvm/test/tools/gold/X86/new-pm.ll
+++ b/llvm/test/tools/gold/X86/new-pm.ll
@@ -10,6 +10,12 @@
 
 ; CHECK: Starting llvm::Module pass manager run
 
+;; --plugin-opt=debug-pass-manager is a no-op for the legacy pass manager.
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:     --plugin-opt=thinlto \
+; RUN:     --plugin-opt=no-new-pass-manager --plugin-opt=debug-pass-manager \
+; RUN:     -o /dev/null %t.o 2>&1 | count 0
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 

diff  --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index adb77ca8219da..b479f8922dc6d 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -288,6 +288,8 @@ namespace options {
       cs_profile_path = std::string(opt);
     } else if (opt == "new-pass-manager") {
       new_pass_manager = true;
+    } else if (opt == "no-new-pass-manager") {
+      new_pass_manager = false;
     } else if (opt == "debug-pass-manager") {
       debug_pass_manager = true;
     } else if (opt == "whole-program-visibility") {


        


More information about the llvm-branch-commits mailing list