Skip to content

Commit 3f25c4b

Browse files
committed
Remove -Zinline-in-all-cgus
1 parent 0e98766 commit 3f25c4b

19 files changed

+11
-36
lines changed

compiler/rustc_interface/src/tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ fn test_unstable_options_tracking_hash() {
789789
tracked!(function_sections, Some(false));
790790
tracked!(human_readable_cgu_names, true);
791791
tracked!(incremental_ignore_spans, true);
792-
tracked!(inline_in_all_cgus, Some(true));
793792
tracked!(inline_mir, Some(true));
794793
tracked!(inline_mir_hint_threshold, Some(123));
795794
tracked!(inline_mir_threshold, Some(123));

compiler/rustc_middle/src/mir/mono.rs

+4-9
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) => {
@@ -119,8 +114,8 @@ impl<'tcx> MonoItem<'tcx> {
119114
}
120115

121116
// At this point we don't have explicit linkage and we're an
122-
// inlined function. If we're inlining into all CGUs then we'll
123-
// be creating a local copy per CGU.
117+
// inlined function. If this crate's build settings permit,
118+
// we'll be creating a local copy per CGU.
124119
if generate_cgu_internal_copies {
125120
return InstantiationMode::LocalCopy;
126121
}

compiler/rustc_session/src/options.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1808,8 +1808,6 @@ options! {
18081808
"verify extended properties for incr. comp. (default: no):
18091809
- hashes of green query instances
18101810
- hash collisions of query keys"),
1811-
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
1812-
"control whether `#[inline]` functions are in all CGUs"),
18131811
inline_llvm: bool = (true, parse_bool, [TRACKED],
18141812
"enable LLVM inlining (default: yes)"),
18151813
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42
//@ compile-flags:-Zinline-mir=no
53

64
#![feature(start)]

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42

53
#![deny(dead_code)]
64
#![feature(start)]

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

+1-2
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
#![feature(start)]

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42

53
#![deny(dead_code)]
64
#![feature(start)]

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42

53
#![deny(dead_code)]
64
#![feature(start)]

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
21
//@ compile-flags:-Zprint-mono-items=eager
3-
//@ compile-flags:-Zinline-in-all-cgus
42

53
#![deny(dead_code)]
64
#![feature(start)]

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

-1
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)]

tests/codegen-units/partitioning/extern-drop-glue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
33
//@ incremental
44
//@ compile-flags:-Zprint-mono-items=lazy
5-
//@ compile-flags:-Zinline-in-all-cgus -Copt-level=0
5+
//@ compile-flags:-Copt-level=0
66

77
#![allow(dead_code)]
88
#![crate_type = "rlib"]

tests/codegen-units/partitioning/inlining-from-extern-crate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// We specify incremental here because we want to test the partitioning for incremental compilation
22
//@ incremental
33
//@ compile-flags:-Zprint-mono-items=lazy
4-
//@ compile-flags:-Zinline-in-all-cgus
54

65
#![crate_type = "lib"]
76

tests/codegen-units/partitioning/local-drop-glue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
33
//@ incremental
44
//@ compile-flags:-Zprint-mono-items=lazy
5-
//@ compile-flags:-Zinline-in-all-cgus -Copt-level=0
5+
//@ compile-flags:-Copt-level=0
66

77
#![allow(dead_code)]
88
#![crate_type = "rlib"]
@@ -33,7 +33,7 @@ pub mod mod1 {
3333
//~ MONO_ITEM fn std::ptr::drop_in_place::<mod1::Struct2> - shim(Some(mod1::Struct2)) @@ local_drop_glue-fallback.cgu[External]
3434
struct Struct2 {
3535
_a: Struct,
36-
//~ MONO_ITEM fn std::ptr::drop_in_place::<(u32, Struct)> - shim(Some((u32, Struct))) @@ local_drop_glue-fallback.cgu[Internal]
36+
//~ MONO_ITEM fn std::ptr::drop_in_place::<(u32, Struct)> - shim(Some((u32, Struct))) @@ local_drop_glue-fallback.cgu[External]
3737
_b: (u32, Struct),
3838
}
3939

tests/codegen-units/partitioning/local-inlining-but-not-all.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// We specify incremental here because we want to test the partitioning for incremental compilation
22
//@ incremental
3-
//@ compile-flags:-Zprint-mono-items=lazy
4-
//@ compile-flags:-Zinline-in-all-cgus=no
3+
//@ compile-flags:-Zprint-mono-items=lazy -Copt-level=0
54

65
#![allow(dead_code)]
76
#![crate_type = "lib"]

tests/codegen-units/partitioning/local-inlining.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// We specify incremental here because we want to test the partitioning for incremental compilation
22
//@ incremental
33
//@ compile-flags:-Zprint-mono-items=lazy
4-
//@ compile-flags:-Zinline-in-all-cgus
54

65
#![allow(dead_code)]
76
#![crate_type = "lib"]

tests/codegen-units/partitioning/local-transitive-inlining.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// We specify incremental here because we want to test the partitioning for incremental compilation
22
//@ incremental
33
//@ compile-flags:-Zprint-mono-items=lazy
4-
//@ compile-flags:-Zinline-in-all-cgus
54

65
#![allow(dead_code)]
76
#![crate_type = "rlib"]

tests/codegen-units/partitioning/vtable-through-const.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// We specify incremental here because we want to test the partitioning for incremental compilation
22
//@ incremental
33
//@ compile-flags:-Zprint-mono-items=lazy
4-
//@ compile-flags:-Zinline-in-all-cgus
54

65
// This test case makes sure, that references made through constants are
76
// recorded properly in the InliningMap.

tests/run-make/sepcomp-cci-copies/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc
88

99
fn main() {
1010
rustc().input("cci_lib.rs").run();
11-
rustc().input("foo.rs").emit("llvm-ir").codegen_units(6).arg("-Zinline-in-all-cgus").run();
11+
rustc().input("foo.rs").emit("llvm-ir").codegen_units(6).arg("-O").arg("-Cno-prepopulate-passes").run();
1212
let re = regex::Regex::new(r#"define\ .*cci_fn"#).unwrap();
1313
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 2);
1414
}

tests/run-make/sepcomp-inlining/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc};
99

1010
fn main() {
11-
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).arg("-Zinline-in-all-cgus").run();
11+
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).arg("-O").arg("-Cno-prepopulate-passes").run();
1212
let re = regex::Regex::new(r#"define\ i32\ .*inlined"#).unwrap();
1313
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 0);
1414
let re = regex::Regex::new(r#"define\ internal\ .*inlined"#).unwrap();

0 commit comments

Comments
 (0)