23c8ed14c9
In 126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
47 lines
1.2 KiB
Rust
47 lines
1.2 KiB
Rust
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
//@ compile-flags: -O --crate-type lib
|
|
|
|
// To avoid MIR blow-up, don't inline large callees into simple shim callers,
|
|
// but *do* inline other trivial things.
|
|
|
|
extern "Rust" {
|
|
fn other_thing(x: i32);
|
|
}
|
|
|
|
#[inline]
|
|
unsafe fn call_twice(x: i32) {
|
|
unsafe {
|
|
other_thing(x);
|
|
other_thing(x);
|
|
}
|
|
}
|
|
|
|
// EMIT_MIR inline_more_in_non_inline.monomorphic_not_inline.Inline.after.mir
|
|
#[no_mangle]
|
|
pub unsafe fn monomorphic_not_inline(x: i32) {
|
|
// CHECK-LABEL: monomorphic_not_inline
|
|
// CHECK: other_thing
|
|
// CHECK: other_thing
|
|
unsafe { call_twice(x) };
|
|
}
|
|
|
|
// EMIT_MIR inline_more_in_non_inline.marked_inline_direct.Inline.after.mir
|
|
#[inline]
|
|
pub unsafe fn marked_inline_direct(x: i32) {
|
|
// CHECK-LABEL: marked_inline_direct
|
|
// CHECK-NOT: other_thing
|
|
// CHECK: call_twice
|
|
// CHECK-NOT: other_thing
|
|
unsafe { call_twice(x) };
|
|
}
|
|
|
|
// EMIT_MIR inline_more_in_non_inline.marked_inline_indirect.Inline.after.mir
|
|
#[inline]
|
|
pub unsafe fn marked_inline_indirect(x: i32) {
|
|
// CHECK-LABEL: marked_inline_indirect
|
|
// CHECK-NOT: other_thing
|
|
// CHECK: call_twice
|
|
// CHECK-NOT: other_thing
|
|
unsafe { marked_inline_direct(x) };
|
|
}
|