2018-02-02 08:31:56 +00:00
|
|
|
// compile-flags: -O
|
2021-04-03 11:05:11 +00:00
|
|
|
//
|
2018-02-02 08:31:56 +00:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
use std::iter;
|
|
|
|
|
|
|
|
// CHECK-LABEL: @repeat_take_collect
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn repeat_take_collect() -> Vec<u8> {
|
2023-07-27 21:44:13 +00:00
|
|
|
// CHECK: call void @llvm.memset.{{.+}}(ptr {{.*}}align 1{{.*}} %{{.*}}, i8 42, i{{[0-9]+}} 100000, i1 false)
|
2018-02-02 08:31:56 +00:00
|
|
|
iter::repeat(42).take(100000).collect()
|
|
|
|
}
|
2022-11-25 03:14:19 +00:00
|
|
|
|
|
|
|
// CHECK-LABEL: @repeat_with_take_collect
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn repeat_with_take_collect() -> Vec<u8> {
|
2023-07-27 21:44:13 +00:00
|
|
|
// CHECK: call void @llvm.memset.{{.+}}(ptr {{.*}}align 1{{.*}} %{{.*}}, i8 13, i{{[0-9]+}} 12345, i1 false)
|
2022-11-25 03:14:19 +00:00
|
|
|
iter::repeat_with(|| 13).take(12345).collect()
|
|
|
|
}
|