forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall-site-inline-attributes.rs
More file actions
40 lines (31 loc) · 1.13 KB
/
Copy pathcall-site-inline-attributes.rs
File metadata and controls
40 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//@ compile-flags: -O -Zinline-mir=no -Cno-prepopulate-passes -Zmerge-functions=disabled
#![crate_type = "lib"]
// This test checks that we add inlinehint for #[inline], noinline for #[inline(never)], and
// alwaysinline for #[inline(always)] to call sites.
#[unsafe(no_mangle)]
fn calls_something_noinline() {
// CHECK-LABEL @calls_something_noinline
// CHECK: call void @{{.*}}noinline_fn() #[[NOINLINE:[0-9]+]]
noinline_fn();
}
#[inline(never)]
fn noinline_fn() {}
#[unsafe(no_mangle)]
fn calls_something_inline() {
// CHECK-LABEL @calls_something_inlinehint
// CHECK: call void @{{.*}}inlinehint_fn() #[[INLINEHINT:[0-9]+]]
inlinehint_fn();
}
#[inline]
fn inlinehint_fn() {}
#[unsafe(no_mangle)]
fn calls_something_alwaysinline() {
// CHECK-LABEL @calls_something_alwaysinline
// CHECK: call void @{{.*}}alwaysinline_fn() #[[ALWAYSINLINE:[0-9]+]]
alwaysinline_fn();
}
#[inline(always)]
fn alwaysinline_fn() {}
//CHECK: attributes #[[NOINLINE]] = {{{.*}} noinline {{.*}}}
//CHECK: attributes #[[INLINEHINT]] = {{{.*}} inlinehint {{.*}}}
//CHECK: attributes #[[ALWAYSINLINE]] = {{{.*}} alwaysinline {{.*}}}