File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 33#![ crate_type = "lib" ]
44
55// This test checks that we can inline drop_in_place in
6- // unwind landing pads. Without this, the box pointers escape,
6+ // unwind landing pads.
7+
8+ // Without inlining, the box pointers escape via the call to drop_in_place,
79// and LLVM will not optimize out the pointer comparison.
10+ // With inlining, everything should be optimized out.
811// See https://github.com/rust-lang/rust/issues/46515
9-
10- // Everything should be optimized out.
1112// CHECK-LABEL: @check_no_escape_in_landingpad
1213// CHECK: start:
1314// CHECK-NEXT: ret void
@@ -20,3 +21,17 @@ pub fn check_no_escape_in_landingpad(f: fn()) {
2021 f ( ) ;
2122 }
2223}
24+
25+ // Without inlining, the compiler can't tell that
26+ // dropping an empty string (in a landing pad) does nothing.
27+ // With inlining, the landing pad should be optimized out.
28+ // See https://github.com/rust-lang/rust/issues/87055
29+ // CHECK-LABEL: @check_eliminate_noop_drop
30+ // CHECK: start:
31+ // CHECK-NEXT: call void %g()
32+ // CHECK-NEXT: ret void
33+ #[ no_mangle]
34+ pub fn check_eliminate_noop_drop ( g : fn ( ) ) {
35+ let _var = String :: new ( ) ;
36+ g ( ) ;
37+ }
You can’t perform that action at this time.
0 commit comments