|
1 |
| -// skip-filecheck |
2 | 1 | // Checks that only functions with compatible attributes are inlined.
|
3 |
| -// |
4 | 2 | // only-x86_64
|
5 |
| -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY |
| 3 | +// compile-flags: -Cpanic=abort |
6 | 4 |
|
7 | 5 | #![crate_type = "lib"]
|
8 | 6 | #![feature(no_sanitize)]
|
9 | 7 | #![feature(target_feature_11)]
|
10 | 8 | #![feature(c_variadic)]
|
11 | 9 |
|
12 |
| -// EMIT_MIR inline_compatibility.inlined_target_feature.Inline.diff |
| 10 | +#[inline] |
| 11 | +#[target_feature(enable = "sse2")] |
| 12 | +unsafe fn sse2() {} |
| 13 | + |
| 14 | +#[inline] |
| 15 | +fn nop() {} |
| 16 | + |
| 17 | +// CHECK-LABEL: fn f0() |
| 18 | +// CHECK: bb0: { |
| 19 | +// CHECK-NEXT: return; |
13 | 20 | #[target_feature(enable = "sse2")]
|
14 |
| -pub unsafe fn inlined_target_feature() { |
15 |
| - target_feature(); |
| 21 | +pub unsafe fn f0() { |
| 22 | + sse2(); |
16 | 23 | }
|
17 | 24 |
|
18 |
| -// EMIT_MIR inline_compatibility.not_inlined_target_feature.Inline.diff |
19 |
| -pub unsafe fn not_inlined_target_feature() { |
20 |
| - target_feature(); |
| 25 | +// CHECK-LABEL: fn f1() |
| 26 | +// CHECK: bb0: { |
| 27 | +// CHECK-NEXT: sse2() |
| 28 | +pub unsafe fn f1() { |
| 29 | + sse2(); |
21 | 30 | }
|
22 | 31 |
|
23 |
| -// EMIT_MIR inline_compatibility.inlined_no_sanitize.Inline.diff |
| 32 | +#[inline] |
| 33 | +#[no_sanitize(address)] |
| 34 | +pub unsafe fn no_sanitize() {} |
| 35 | + |
| 36 | +// CHECK-LABEL: fn inlined_no_sanitize() |
| 37 | +// CHECK: bb0: { |
| 38 | +// CHECK-NEXT: return; |
24 | 39 | #[no_sanitize(address)]
|
25 | 40 | pub unsafe fn inlined_no_sanitize() {
|
26 | 41 | no_sanitize();
|
27 | 42 | }
|
28 | 43 |
|
29 |
| -// EMIT_MIR inline_compatibility.not_inlined_no_sanitize.Inline.diff |
| 44 | +// CHECK-LABEL: fn not_inlined_no_sanitize() |
| 45 | +// CHECK: bb0: { |
| 46 | +// CHECK-NEXT: no_sanitize() |
30 | 47 | pub unsafe fn not_inlined_no_sanitize() {
|
31 | 48 | no_sanitize();
|
32 | 49 | }
|
33 | 50 |
|
34 |
| -#[inline] |
35 |
| -#[target_feature(enable = "sse2")] |
36 |
| -pub unsafe fn target_feature() {} |
37 |
| - |
38 |
| -#[inline] |
39 |
| -#[no_sanitize(address)] |
40 |
| -pub unsafe fn no_sanitize() {} |
41 |
| - |
42 |
| -// EMIT_MIR inline_compatibility.not_inlined_c_variadic.Inline.diff |
| 51 | +// CHECK-LABEL: fn not_inlined_c_variadic() |
| 52 | +// CHECK: bb0: { |
| 53 | +// CHECK-NEXT: StorageLive(_1) |
| 54 | +// CHECK-NEXT: _1 = sum |
43 | 55 | pub unsafe fn not_inlined_c_variadic() {
|
44 |
| - let s = sum(4u32, 4u32, 30u32, 200u32, 1000u32); |
| 56 | + let _ = sum(4u32, 4u32, 30u32, 200u32, 1000u32); |
45 | 57 | }
|
46 | 58 |
|
47 |
| -#[no_mangle] |
48 | 59 | #[inline(always)]
|
| 60 | +#[no_mangle] |
49 | 61 | unsafe extern "C" fn sum(n: u32, mut vs: ...) -> u32 {
|
50 | 62 | let mut s = 0;
|
51 | 63 | let mut i = 0;
|
|
0 commit comments