|
| 1 | +//@ compile-flags: -O |
| 2 | + |
| 3 | +#![crate_type = "lib"] |
| 4 | + |
| 5 | +use std::collections::VecDeque; |
| 6 | + |
| 7 | +#[no_mangle] |
| 8 | +// CHECK-LABEL: @noop_back( |
| 9 | +pub fn noop_back(v: &mut VecDeque<u8>) { |
| 10 | + // CHECK-NOT: reserve_for_push |
| 11 | + // CHECK-NOT: call |
| 12 | + // CHECK: tail call void @llvm.assume |
| 13 | + // CHECK-NOT: reserve_for_push |
| 14 | + // CHECK-NOT: call |
| 15 | + // CHECK: ret |
| 16 | + if let Some(x) = v.pop_back() { |
| 17 | + v.push_back(x); |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +#[no_mangle] |
| 22 | +// CHECK-LABEL: @noop_front( |
| 23 | +pub fn noop_front(v: &mut VecDeque<u8>) { |
| 24 | + // CHECK-NOT: reserve_for_push |
| 25 | + // CHECK-NOT: call |
| 26 | + // CHECK: tail call void @llvm.assume |
| 27 | + // CHECK-NOT: reserve_for_push |
| 28 | + // CHECK-NOT: call |
| 29 | + // CHECK: ret |
| 30 | + if let Some(x) = v.pop_front() { |
| 31 | + v.push_front(x); |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +#[no_mangle] |
| 36 | +// CHECK-LABEL: @move_byte_front_to_back( |
| 37 | +pub fn move_byte_front_to_back(v: &mut VecDeque<u8>) { |
| 38 | + // CHECK-NOT: reserve_for_push |
| 39 | + // CHECK-NOT: call |
| 40 | + // CHECK: tail call void @llvm.assume |
| 41 | + // CHECK-NOT: reserve_for_push |
| 42 | + // CHECK-NOT: call |
| 43 | + // CHECK: ret |
| 44 | + if let Some(x) = v.pop_front() { |
| 45 | + v.push_back(x); |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +#[no_mangle] |
| 50 | +// CHECK-LABEL: @move_byte_back_to_front( |
| 51 | +pub fn move_byte_back_to_front(v: &mut VecDeque<u8>) { |
| 52 | + // CHECK-NOT: reserve_for_push |
| 53 | + // CHECK-NOT: call |
| 54 | + // CHECK: tail call void @llvm.assume |
| 55 | + // CHECK-NOT: reserve_for_push |
| 56 | + // CHECK-NOT: call |
| 57 | + // CHECK: ret |
| 58 | + if let Some(x) = v.pop_back() { |
| 59 | + v.push_front(x); |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +#[no_mangle] |
| 64 | +// CHECK-LABEL: @push_back_byte( |
| 65 | +pub fn push_back_byte(v: &mut VecDeque<u8>) { |
| 66 | + // CHECK: call {{.*}}reserve_for_push |
| 67 | + v.push_back(3); |
| 68 | +} |
| 69 | + |
| 70 | +#[no_mangle] |
| 71 | +// CHECK-LABEL: @push_front_byte( |
| 72 | +pub fn push_front_byte(v: &mut VecDeque<u8>) { |
| 73 | + // CHECK: call {{.*}}reserve_for_push |
| 74 | + v.push_front(3); |
| 75 | +} |
0 commit comments