This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -O -C no-prepopulate-passes
2+
3+ #![ crate_type = "lib" ]
4+
5+ #[ repr( transparent) ]
6+ struct Transparent32 ( u32 ) ;
7+
8+ // CHECK: i32 @make_transparent(i32 noundef %x)
9+ #[ no_mangle]
10+ pub fn make_transparent ( x : u32 ) -> Transparent32 {
11+ // CHECK: %a = alloca i32
12+ // CHECK: store i32 %x, ptr %a
13+ // CHECK: %[[TEMP:.+]] = load i32, ptr %a
14+ // CHECK: ret i32 %[[TEMP]]
15+ let a = Transparent32 ( x) ;
16+ a
17+ }
18+
19+ // CHECK: i32 @make_closure(i32 noundef %x)
20+ #[ no_mangle]
21+ pub fn make_closure ( x : i32 ) -> impl Fn ( i32 ) -> i32 {
22+ // CHECK: %[[ALLOCA:.+]] = alloca i32
23+ // CHECK: store i32 %x, ptr %[[ALLOCA]]
24+ // CHECK: %[[TEMP:.+]] = load i32, ptr %[[ALLOCA]]
25+ // CHECK: ret i32 %[[TEMP]]
26+ move |y| x + y
27+ }
28+
29+ // CHECK-LABEL: { i32, i32 } @make_2_tuple(i32 noundef %x)
30+ #[ no_mangle]
31+ pub fn make_2_tuple ( x : u32 ) -> ( u32 , u32 ) {
32+ // CHECK: %pair = alloca { i32, i32 }
33+ // CHECK: store i32
34+ // CHECK: store i32
35+ // CHECK: load i32
36+ // CHECK: load i32
37+ let pair = ( x, x) ;
38+ pair
39+ }
You can’t perform that action at this time.
0 commit comments