|
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 | +// CHECK-LABEL: fn f2() |
| 33 | +// CHECK: bb0: { |
| 34 | +// CHECK-NEXT: nop() |
| 35 | +#[target_feature(enable = "avx")] |
| 36 | +pub unsafe fn f2() { |
| 37 | + nop(); |
| 38 | +} |
| 39 | + |
| 40 | +#[inline] |
| 41 | +#[no_sanitize(address)] |
| 42 | +pub unsafe fn no_sanitize() {} |
| 43 | + |
| 44 | +// CHECK-LABEL: fn inlined_no_sanitize() |
| 45 | +// CHECK: bb0: { |
| 46 | +// CHECK-NEXT: return; |
24 | 47 | #[no_sanitize(address)]
|
25 | 48 | pub unsafe fn inlined_no_sanitize() {
|
26 | 49 | no_sanitize();
|
27 | 50 | }
|
28 | 51 |
|
29 |
| -// EMIT_MIR inline_compatibility.not_inlined_no_sanitize.Inline.diff |
| 52 | +// CHECK-LABEL: fn not_inlined_no_sanitize() |
| 53 | +// CHECK: bb0: { |
| 54 | +// CHECK-NEXT: no_sanitize() |
30 | 55 | pub unsafe fn not_inlined_no_sanitize() {
|
31 | 56 | no_sanitize();
|
32 | 57 | }
|
33 | 58 |
|
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 |
| 59 | +// CHECK-LABEL: fn not_inlined_c_variadic() |
| 60 | +// CHECK: bb0: { |
| 61 | +// CHECK-NEXT: StorageLive(_1) |
| 62 | +// CHECK-NEXT: _1 = sum |
43 | 63 | pub unsafe fn not_inlined_c_variadic() {
|
44 |
| - let s = sum(4u32, 4u32, 30u32, 200u32, 1000u32); |
| 64 | + let _ = sum(4u32, 4u32, 30u32, 200u32, 1000u32); |
45 | 65 | }
|
46 | 66 |
|
47 |
| -#[no_mangle] |
48 | 67 | #[inline(always)]
|
| 68 | +#[no_mangle] |
49 | 69 | unsafe extern "C" fn sum(n: u32, mut vs: ...) -> u32 {
|
50 | 70 | let mut s = 0;
|
51 | 71 | let mut i = 0;
|
|
0 commit comments