Auto merge of #53356 - michaelwoerister:itlto, r=alexcrichton
Preliminary work for incremental ThinLTO (CGU name edition) Bring back the first half of #52266 but hopefully without the performance regression.
This commit is contained in:
commit
1fa944914c
21 changed files with 329 additions and 170 deletions
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#![feature(start)]
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
|
||||
struct StructWithDtor(u32);
|
||||
|
||||
impl Drop for StructWithDtor {
|
||||
|
|
@ -26,7 +26,7 @@ impl Drop for StructWithDtor {
|
|||
#[start]
|
||||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
|
||||
let x = [StructWithDtor(0), StructWithDtor(1)];
|
||||
|
||||
drop_slice_in_place(&x);
|
||||
|
|
@ -40,7 +40,7 @@ fn drop_slice_in_place(x: &[StructWithDtor]) {
|
|||
// This is the interesting thing in this test case: Normally we would
|
||||
// not have drop-glue for the unsized [StructWithDtor]. This has to be
|
||||
// generated though when the drop_in_place() intrinsic is used.
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
|
||||
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ enum EnumNoDrop<T1, T2> {
|
|||
struct NonGenericNoDrop(i32);
|
||||
|
||||
struct NonGenericWithDrop(i32);
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
|
||||
|
||||
impl Drop for NonGenericWithDrop {
|
||||
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
|
||||
|
|
@ -57,11 +57,11 @@ impl Drop for NonGenericWithDrop {
|
|||
//~ MONO_ITEM fn generic_drop_glue::start[0]
|
||||
#[start]
|
||||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
|
||||
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
|
||||
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
|
||||
|
||||
|
|
@ -70,17 +70,17 @@ fn start(_: isize, _: *const *const u8) -> isize {
|
|||
|
||||
// This is supposed to generate drop-glue because it contains a field that
|
||||
// needs to be dropped.
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
|
||||
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
|
||||
let _ = match EnumWithDrop::A::<i32, i64>(0) {
|
||||
EnumWithDrop::A(x) => x,
|
||||
EnumWithDrop::B(x) => x as i32
|
||||
};
|
||||
|
||||
//~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue0[Internal]
|
||||
//~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
|
||||
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
|
||||
EnumWithDrop::A(x) => x,
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ impl<T> Trait for Struct<T> {
|
|||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
let s1 = Struct { _a: 0u32 };
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
|
||||
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
|
||||
let _ = &s1 as &Trait;
|
||||
|
||||
let s1 = Struct { _a: 0u64 };
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
|
||||
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
|
||||
let _ = &s1 as &Trait;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#![deny(dead_code)]
|
||||
#![feature(start)]
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
|
||||
struct StructWithDrop {
|
||||
x: i32
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ struct StructNoDrop {
|
|||
x: i32
|
||||
}
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
|
||||
enum EnumWithDrop {
|
||||
A(i32)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
#![deny(dead_code)]
|
||||
#![feature(start)]
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
struct Root(Intermediate);
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
struct Intermediate(Leaf);
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
struct Leaf;
|
||||
|
||||
impl Drop for Leaf {
|
||||
|
|
@ -40,15 +40,15 @@ impl<T> Drop for LeafGen<T> {
|
|||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
let _ = Root(Intermediate(Leaf));
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
|
||||
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
|
||||
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#![deny(dead_code)]
|
||||
#![feature(start)]
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
|
||||
struct Dropped;
|
||||
|
||||
impl Drop for Dropped {
|
||||
|
|
@ -26,11 +26,11 @@ impl Drop for Dropped {
|
|||
//~ MONO_ITEM fn tuple_drop_glue::start[0]
|
||||
#[start]
|
||||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
|
||||
let x = (0u32, Dropped);
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
|
||||
let x = (0i16, (Dropped, true));
|
||||
|
||||
0
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T>
|
|||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
// simple case
|
||||
let bool_sized = &true;
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
|
||||
let _bool_unsized = bool_sized as &Trait;
|
||||
|
||||
let char_sized = &'a';
|
||||
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
|
||||
let _char_unsized = char_sized as &Trait;
|
||||
|
||||
|
|
@ -75,13 +75,13 @@ fn start(_: isize, _: *const *const u8) -> isize {
|
|||
_b: 2,
|
||||
_c: 3.0f64
|
||||
};
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
|
||||
let _struct_unsized = struct_sized as &Struct<Trait>;
|
||||
|
||||
// custom coercion
|
||||
let wrapper_sized = Wrapper(&0u32);
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing0[Internal]
|
||||
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
|
||||
//~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
|
||||
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// revisions:rpass1 rpass2
|
||||
// compile-flags: -Z query-dep-graph
|
||||
|
||||
#![rustc_partition_reused(module="__rustc_fallback_codegen_unit", cfg="rpass2")]
|
||||
#![rustc_partition_reused(module="generic-fallback.cgu", cfg="rpass2")]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#![crate_type="rlib"]
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@ all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib
|
|||
staticlib: lib.rs
|
||||
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a
|
||||
$(call EXTRACT_OBJS, liblib.a)
|
||||
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib.lib0.rcgu.o
|
||||
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
|
||||
|
||||
staticlib-fat-lto: lib.rs
|
||||
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat
|
||||
$(call EXTRACT_OBJS, liblib-fat-lto.a)
|
||||
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib-fat-lto.lib0.rcgu.o
|
||||
for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
|
||||
|
||||
staticlib-thin-lto: lib.rs
|
||||
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin
|
||||
$(call EXTRACT_OBJS, liblib-thin-lto.a)
|
||||
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib-thin-lto.lib0.rcgu.o
|
||||
for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
|
||||
|
||||
rlib: lib.rs
|
||||
$(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib
|
||||
$(call EXTRACT_OBJS, liblib.rlib)
|
||||
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib.lib0.rcgu.o
|
||||
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
|
||||
|
||||
cdylib: lib.rs
|
||||
$(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
all:
|
||||
$(RUSTC) -C extra-filename=bar foo.rs -C save-temps
|
||||
rm $(TMPDIR)/foobar.foo0.rcgu.o
|
||||
rm $(TMPDIR)/foobar.foo*0.rcgu.o
|
||||
rm $(TMPDIR)/$(call BIN,foobar)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
warning: Linking globals named 'foo': symbol multiply defined!
|
||||
|
||||
error: failed to load bc of "lto_duplicate_symbols10-8787f43e282added376259c1adb08b80.rs":
|
||||
error: failed to load bc of "lto_duplicate_symbols1.3a1fbbbh-cgu.0":
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue