File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 3
3
#![ crate_type = "lib" ]
4
4
5
5
// 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,
7
9
// and LLVM will not optimize out the pointer comparison.
10
+ // With inlining, everything should be optimized out.
8
11
// See https://github.com/rust-lang/rust/issues/46515
9
-
10
- // Everything should be optimized out.
11
12
// CHECK-LABEL: @check_no_escape_in_landingpad
12
13
// CHECK: start:
13
14
// CHECK-NEXT: ret void
@@ -20,3 +21,17 @@ pub fn check_no_escape_in_landingpad(f: fn()) {
20
21
f ( ) ;
21
22
}
22
23
}
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