Skip to content

Commit aa6f5ab

Browse files
committed
Auto merge of rust-lang#133929 - saethlin:remove-inline-in-all-cgus, r=nnethercote
Remove -Zinline-in-all-cgus and clean up tests/codegen-units/ Implementation of rust-lang/compiler-team#814 I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of `tests/codegen-units` and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using `-Zprint-mono-items=lazy` in the partitioning tests improves that. I've also deleted some of the `tests/run-make/sepcomp` tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.
2 parents 66d6064 + bf9df97 commit aa6f5ab

34 files changed

+187
-367
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,6 @@ fn test_unstable_options_tracking_hash() {
797797
tracked!(function_sections, Some(false));
798798
tracked!(human_readable_cgu_names, true);
799799
tracked!(incremental_ignore_spans, true);
800-
tracked!(inline_in_all_cgus, Some(true));
801800
tracked!(inline_mir, Some(true));
802801
tracked!(inline_mir_hint_threshold, Some(123));
803802
tracked!(inline_mir_threshold, Some(123));

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,8 @@ impl<'tcx> MonoItem<'tcx> {
9191
}
9292

9393
pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode {
94-
let generate_cgu_internal_copies = tcx
95-
.sess
96-
.opts
97-
.unstable_opts
98-
.inline_in_all_cgus
99-
.unwrap_or_else(|| tcx.sess.opts.optimize != OptLevel::No)
100-
&& !tcx.sess.link_dead_code();
94+
let generate_cgu_internal_copies =
95+
(tcx.sess.opts.optimize != OptLevel::No) && !tcx.sess.link_dead_code();
10196

10297
match *self {
10398
MonoItem::Fn(ref instance) => {
@@ -121,8 +116,8 @@ impl<'tcx> MonoItem<'tcx> {
121116
}
122117

123118
// At this point we don't have explicit linkage and we're an
124-
// inlined function. If we're inlining into all CGUs then we'll
125-
// be creating a local copy per CGU.
119+
// inlined function. If this crate's build settings permit,
120+
// we'll be creating a local copy per CGU.
126121
if generate_cgu_internal_copies {
127122
return InstantiationMode::LocalCopy;
128123
}

compiler/rustc_session/src/options.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,8 +1870,6 @@ options! {
18701870
"verify extended properties for incr. comp. (default: no):
18711871
- hashes of green query instances
18721872
- hash collisions of query keys"),
1873-
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
1874-
"control whether `#[inline]` functions are in all CGUs"),
18751873
inline_llvm: bool = (true, parse_bool, [TRACKED],
18761874
"enable LLVM inlining (default: yes)"),
18771875
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],

tests/codegen-units/item-collection/drop_in_place_intrinsic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42
//@ compile-flags:-Zinline-mir=no
3+
//@ compile-flags: -O
54

65
#![crate_type = "lib"]
76

tests/codegen-units/item-collection/generic-drop-glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
2+
//@ compile-flags: -O
43

54
#![deny(dead_code)]
65
#![crate_type = "lib"]

tests/codegen-units/item-collection/instantiation-through-vtable.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//
2-
//@ compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0
1+
//@ compile-flags:-Zprint-mono-items=eager -Zmir-opt-level=0
32

43
#![deny(dead_code)]
54
#![crate_type = "lib"]

tests/codegen-units/item-collection/non-generic-drop-glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
2+
//@ compile-flags: -O
43

54
#![deny(dead_code)]
65
#![crate_type = "lib"]

tests/codegen-units/item-collection/transitive-drop-glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
2+
//@ compile-flags: -O
43

54
#![deny(dead_code)]
65
#![crate_type = "lib"]

tests/codegen-units/item-collection/tuple-drop-glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
2+
//@ compile-flags: -O
43

54
#![deny(dead_code)]
65
#![crate_type = "lib"]

tests/codegen-units/item-collection/unsizing.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ compile-flags:-Zprint-mono-items=eager
2-
//@ compile-flags:-Zinline-in-all-cgus
32
//@ compile-flags:-Zmir-opt-level=0
43

54
#![deny(dead_code)]

0 commit comments

Comments
 (0)