[llvm-branch-commits] [lld] 07f234b - [lld] Add --no-lto-whole-program-visibility
Teresa Johnson via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Nov 24 16:50:22 PST 2020
Author: Teresa Johnson
Date: 2020-11-24T16:46:08-08:00
New Revision: 07f234be1ccbce131704f580aa3f117083a887f7
URL: https://github.com/llvm/llvm-project/commit/07f234be1ccbce131704f580aa3f117083a887f7
DIFF: https://github.com/llvm/llvm-project/commit/07f234be1ccbce131704f580aa3f117083a887f7.diff
LOG: [lld] Add --no-lto-whole-program-visibility
Enables overriding earlier --lto-whole-program-visibility.
Variant of D91583 while discussing alternate ways to identify and
handle the --export-dynamic case.
Differential Revision: https://reviews.llvm.org/D92060
Added:
Modified:
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/test/ELF/lto/devirt_vcall_vis_public.ll
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 783b85e7e27a6..c3f3d88b5d2d4 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -990,7 +990,8 @@ static void readConfigs(opt::InputArgList &args) {
config->ltoNewPassManager = args.hasArg(OPT_lto_new_pass_manager);
config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes);
config->ltoWholeProgramVisibility =
- args.hasArg(OPT_lto_whole_program_visibility);
+ args.hasFlag(OPT_lto_whole_program_visibility,
+ OPT_no_lto_whole_program_visibility, false);
config->ltoo = args::getInteger(args, OPT_lto_O, 2);
config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path_eq);
config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1);
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 5171c08a8291f..db1c5d9698423 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -539,8 +539,9 @@ def lto_cs_profile_file: JJ<"lto-cs-profile-file=">,
def lto_obj_path_eq: JJ<"lto-obj-path=">;
def lto_sample_profile: JJ<"lto-sample-profile=">,
HelpText<"Sample profile file path">;
-def lto_whole_program_visibility: FF<"lto-whole-program-visibility">,
- HelpText<"Asserts that the LTO link has whole program visibility">;
+defm lto_whole_program_visibility: BB<"lto-whole-program-visibility",
+ "Asserts that the LTO link has whole program visibility",
+ "Asserts that the LTO link does not have whole program visibility">;
def disable_verify: F<"disable-verify">;
defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;
def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
diff --git a/lld/test/ELF/lto/devirt_vcall_vis_public.ll b/lld/test/ELF/lto/devirt_vcall_vis_public.ll
index 0d344ec9483df..46e23537d4fa5 100644
--- a/lld/test/ELF/lto/devirt_vcall_vis_public.ll
+++ b/lld/test/ELF/lto/devirt_vcall_vis_public.ll
@@ -1,6 +1,9 @@
; REQUIRES: x86
; Test that --lto-whole-program-visibility enables devirtualization.
+; Note that the --export-dynamic used below is simply to ensure symbols are
+; retained during linking.
+
; Index based WPD
; Generate unsplit module with summary for ThinLTO index-based WPD.
; RUN: opt --thinlto-bc -o %t2.o %s
@@ -31,6 +34,10 @@
; RUN: ld.lld %t2.o -o %t3 -save-temps \
; RUN: -mllvm -pass-remarks=. --export-dynamic 2>&1 | FileCheck %s --implicit-check-not single-impl --allow-empty
; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-NODEVIRT-IR
+; Ensure --no-lto-whole-program-visibility overrides explicit --lto-whole-program-visibility.
+; RUN: ld.lld %t2.o -o %t3 -save-temps --lto-whole-program-visibility --no-lto-whole-program-visibility \
+; RUN: -mllvm -pass-remarks=. --export-dynamic 2>&1 | FileCheck %s --implicit-check-not single-impl --allow-empty
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-NODEVIRT-IR
; Hybrid WPD
; RUN: ld.lld %t.o -o %t3 -save-temps \
More information about the llvm-branch-commits
mailing list