[lld] 99d8241 - [LLD][ELF][NewPM] Add option to force legacy PM

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 13:41:28 PST 2020


Author: Arthur Eubanks
Date: 2020-12-01T13:41:17-08:00
New Revision: 99d82412f822190a6caa3e3a5b9f87b71f56de47

URL: https://github.com/llvm/llvm-project/commit/99d82412f822190a6caa3e3a5b9f87b71f56de47
DIFF: https://github.com/llvm/llvm-project/commit/99d82412f822190a6caa3e3a5b9f87b71f56de47.diff

LOG: [LLD][ELF][NewPM] Add option to force legacy PM

In preparation for the NPM switch.

Reviewed By: MaskRay

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

Added: 
    

Modified: 
    lld/ELF/Driver.cpp
    lld/ELF/Options.td
    lld/test/ELF/lto/new-pass-manager.ll

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 860c74fa0d20..395b6200aa08 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -988,7 +988,8 @@ static void readConfigs(opt::InputArgList &args) {
   config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
   config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
   config->ltoEmitAsm = args.hasArg(OPT_lto_emit_asm);
-  config->ltoNewPassManager = args.hasArg(OPT_lto_new_pass_manager);
+  config->ltoNewPassManager = args.hasFlag(OPT_lto_new_pass_manager,
+                                           OPT_no_lto_new_pass_manager, false);
   config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes);
   config->ltoWholeProgramVisibility =
       args.hasFlag(OPT_lto_whole_program_visibility,

diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index fc7089f63229..c3490b6f9d7a 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -526,8 +526,9 @@ def lto_debug_pass_manager: FF<"lto-debug-pass-manager">,
   HelpText<"Debug new pass manager">;
 def lto_emit_asm: FF<"lto-emit-asm">,
   HelpText<"Emit assembly code">;
-def lto_new_pass_manager: FF<"lto-new-pass-manager">,
-  HelpText<"Use new pass manager">;
+defm lto_new_pass_manager: BB<"lto-new-pass-manager",
+  "Use new pass manager",
+  "Use legacy pass manager">;
 def lto_newpm_passes: JJ<"lto-newpm-passes=">,
   HelpText<"Passes to run during LTO">;
 def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,

diff  --git a/lld/test/ELF/lto/new-pass-manager.ll b/lld/test/ELF/lto/new-pass-manager.ll
index 84f4ad1856e4..941235b48630 100644
--- a/lld/test/ELF/lto/new-pass-manager.ll
+++ b/lld/test/ELF/lto/new-pass-manager.ll
@@ -2,13 +2,15 @@
 ; RUN: opt -module-summary %s -o %t.o
 
 ; Test new-pass-manager and debug-pass-manager option
-; RUN: ld.lld --plugin-opt=new-pass-manager --plugin-opt=debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
-; RUN: ld.lld --plugin-opt=new-pass-manager --lto-debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
-; RUN: ld.lld --lto-new-pass-manager --plugin-opt=debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
-; RUN: ld.lld --lto-new-pass-manager --lto-debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
+; RUN: ld.lld --plugin-opt=new-pass-manager --plugin-opt=debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
+; RUN: ld.lld --plugin-opt=new-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
+; 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
 
 ; CHECK: Starting llvm::Module pass manager run
 ; CHECK: Finished llvm::Module pass manager run
+; LEGACY-NOT: Starting llvm::Module pass manager run
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"


        


More information about the llvm-commits mailing list