[gold] Remove support for legacy pass manager

This removes support for performing LTO using the legacy pass
manager in LLVMgold.so. Explicitly enabling the new pass manager
is retained as a no-op.

Differential Revision: https://reviews.llvm.org/D123294
This commit is contained in:
Nikita Popov 2022-04-07 11:30:08 +02:00
parent f922dbb792
commit 6ec8c6fc7b
7 changed files with 21 additions and 41 deletions

View File

@ -2,12 +2,11 @@
; REQUIRES: asserts
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=disable-verify --plugin-opt=legacy-pass-manager \
; RUN: --plugin-opt=-debug-pass=Arguments \
; RUN: --plugin-opt=disable-verify --plugin-opt=debug-pass-manager \
; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=-debug-pass=Arguments --plugin-opt=legacy-pass-manager \
; RUN: --plugin-opt=debug-pass-manager \
; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s -check-prefix=VERIFY
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@ -15,10 +14,10 @@ target triple = "x86_64-unknown-linux-gnu"
; -disable-verify should disable output verification from the optimization
; pipeline.
; CHECK: Pass Arguments: {{.*}} -verify -
; CHECK-NOT: -verify
; CHECK-NOT: VerifierPass
; VERIFY: Pass Arguments: {{.*}} -verify {{.*}} -verify
; VERIFY: Running pass: VerifierPass on [module]
; VERIFY: Running pass: VerifierPass on [module]
define void @f() {
entry:

View File

@ -10,12 +10,6 @@
; CHECK: Running pass:
;; --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=legacy-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"

View File

@ -1,17 +1,4 @@
; RUN: llvm-as -o %t.bc %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 \
; RUN: -plugin-opt=O0 -r -o %t.o %t.bc
; RUN: llvm-dis < %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 --plugin-opt=legacy-pass-manager \
; RUN: -plugin-opt=O1 -r -o %t.o %t.bc
; RUN: llvm-dis < %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 --check-prefix=CHECK-O1-OLDPM %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 \
; RUN: -plugin-opt=O2 -r -o %t.o %t.bc
; RUN: llvm-dis < %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 --plugin-opt=new-pass-manager \
; RUN: -plugin-opt=O0 -r -o %t.o %t.bc
@ -19,7 +6,7 @@
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 --plugin-opt=new-pass-manager \
; RUN: -plugin-opt=O1 -r -o %t.o %t.bc
; RUN: llvm-dis < %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 --check-prefix=CHECK-O1-NEWPM %s
; RUN: llvm-dis < %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=save-temps \
; RUN: -m elf_x86_64 --plugin-opt=new-pass-manager \
; RUN: -plugin-opt=O2 -r -o %t.o %t.bc
@ -49,9 +36,7 @@ f:
end:
; CHECK-O0: phi
; CHECK-O1-OLDPM: select
; The new PM does not do as many optimizations at O1
; CHECK-O1-NEWPM: phi
; CHECK-O1: phi
%r = phi i32 [ 1, %t ], [ 2, %f ]
ret i32 %r
}

View File

@ -1,7 +1,7 @@
; Test plugin options for opt-remarks.
; RUN: llvm-as %s -o %t.o
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \
; RUN: -plugin-opt=save-temps -plugin-opt=legacy-pass-manager \
; RUN: -plugin-opt=save-temps \
; RUN: -plugin-opt=opt-remarks-passes=inline \
; RUN: -plugin-opt=opt-remarks-format=yaml \
; RUN: -plugin-opt=opt-remarks-filename=%t.yaml %t.o -o %t2.o 2>&1
@ -44,6 +44,16 @@
; YAML-NEXT: - Caller: f
; YAML-NEXT: - String: ' because its definition is unavailable'
; YAML-NEXT: ...
; YAML-NEXT: --- !Missed
; YAML-NEXT: Pass: inline
; YAML-NEXT: Name: NoDefinition
; YAML-NEXT: Function: f
; YAML-NEXT: Args:
; YAML-NEXT: - Callee: bar
; YAML-NEXT: - String: ' will not be inlined into '
; YAML-NEXT: - Caller: f
; YAML-NEXT: - String: ' because its definition is unavailable'
; YAML-NEXT: ...
; YAML-NEXT: --- !Passed
; YAML-NEXT: Pass: inline
; YAML-NEXT: Name: Inlined

View File

@ -1,8 +1,7 @@
; RUN: llvm-as %s -o %t.o
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=save-temps --plugin-opt=legacy-pass-manager \
; RUN: -shared %t.o -o %t2.o
; RUN: --plugin-opt=save-temps -shared %t.o -o %t2.o
; RUN: llvm-dis %t2.o.0.4.opt.bc -o - | FileCheck %s
; test that the vectorizer is run.

View File

@ -1,8 +1,7 @@
; RUN: llvm-as %s -o %t.o
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=save-temps --plugin-opt=legacy-pass-manager \
; RUN: -shared %t.o -o %t2.o
; RUN: --plugin-opt=save-temps -shared %t.o -o %t2.o
; RUN: llvm-dis %t2.o.0.4.opt.bc -o - | FileCheck %s
; test that the vectorizer is run.

View File

@ -200,8 +200,6 @@ namespace options {
static std::vector<const char *> extra;
// Sample profile file path
static std::string sample_profile;
// New pass manager
static bool new_pass_manager = true;
// Debug new pass manager
static bool debug_pass_manager = false;
// Directory to store the .dwo files.
@ -287,9 +285,7 @@ namespace options {
} else if (opt.consume_front("cs-profile-path=")) {
cs_profile_path = std::string(opt);
} else if (opt == "new-pass-manager") {
new_pass_manager = true;
} else if (opt == "legacy-pass-manager") {
new_pass_manager = false;
// We always use the new pass manager.
} else if (opt == "debug-pass-manager") {
debug_pass_manager = true;
} else if (opt == "whole-program-visibility") {
@ -956,8 +952,6 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,
Conf.RemarksHotnessThreshold = options::RemarksHotnessThreshold;
Conf.RemarksFormat = options::RemarksFormat;
// Use new pass manager if set in driver
Conf.UseNewPM = options::new_pass_manager;
// Debug new pass manager if requested
Conf.DebugPassManager = options::debug_pass_manager;