Skip to content

Commit

Permalink
Strengthen the repeat-trusted-len test
Browse files Browse the repository at this point in the history
Simply checking for the presence of `llvm.memset` is too brittle because
this instrinsic can be used for seemingly trivial operations, such as
zero-initializing a `RawVec`.
  • Loading branch information
FraGag committed Mar 27, 2018
1 parent afa7f5b commit d032a4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/codegen/repeat-trusted-len.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@

use std::iter;

// CHECK: @helper([[USIZE:i[0-9]+]] %arg0)
#[no_mangle]
pub fn helper(_: usize) {
}

// CHECK-LABEL: @repeat_take_collect
#[no_mangle]
pub fn repeat_take_collect() -> Vec<u8> {
// CHECK: call void @llvm.memset.p0i8
// CHECK: call void @llvm.memset.p0i8.[[USIZE]](i8* {{(nonnull )?}}%{{[0-9]+}}, i8 42, [[USIZE]] 100000, i32 1, i1 false)
iter::repeat(42).take(100000).collect()
}

0 comments on commit d032a4b

Please sign in to comment.