File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,34 @@ pub fn nonzero_integer_array() {
6363 opaque ( & x) ;
6464}
6565
66+ const N : usize = 100 ;
67+
68+ // FIXME: The two bytes of the u16 are the same, so we should
69+ // just use memset, too.
70+ // CHECK-LABEL: @u16_init_one_bytes
71+ #[ no_mangle]
72+ pub fn u16_init_one_bytes ( ) -> [ u16 ; N ] {
73+ // CHECK-NOT: select
74+ // CHECK: br
75+ // CHECK-NOT: switch
76+ // CHECK: icmp
77+ // CHECK-NOT: call void @llvm.memset.p0
78+ [ const { u16:: from_be_bytes ( [ 1 , 1 ] ) } ; N ]
79+ }
80+
81+ // FIXME: undef bytes can just be initialized with the same value as the
82+ // defined bytes, if the defines bytes are all the same.
83+ // CHECK-LABEL: @option_none_init
84+ #[ no_mangle]
85+ pub fn option_none_init ( ) -> [ Option < u8 > ; N ] {
86+ // CHECK-NOT: select
87+ // CHECK: br label %repeat_loop_header{{.*}}
88+ // CHECK-NOT: switch
89+ // CHECK: icmp
90+ // CHECK-NOT: call void @llvm.memset.p0
91+ [ None ; N ]
92+ }
93+
6694// Use an opaque function to prevent rustc from removing useless drops.
6795#[ inline( never) ]
6896pub fn opaque ( _: impl Sized ) { }
You can’t perform that action at this time.
0 commit comments