about summary refs log tree commit diff
path: root/tests/mir-opt/instsimplify/simplify_repeat.rs
blob: abcdf32072b1e97ca4111174814016cd9654f5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@ test-mir-pass: InstSimplify-after-simplifycfg
//@ compile-flags: -C panic=abort
#![crate_type = "lib"]

const MYSTERY: usize = 3_usize.pow(2) - 2_usize.pow(3);

// EMIT_MIR simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff
pub fn repeat_once_to_aggregate<T: Copy>(x: T) -> [T; 1] {
    // CHECK-LABEL: fn repeat_once_to_aggregate(
    // CHECK: debug other => [[OTHER:_[0-9]+]]
    // CHECK-NOT: [move {{_[0-9]+}}; 1]
    // CHECK: [[OTHER]] = [move {{_[0-9]+}}];
    // CHECK-NOT: [move {{_[0-9]+}}; 1]
    // CHECK: _0 = [move {{_[0-9]+}}];
    // CHECK-NOT: [move {{_[0-9]+}}; 1]

    let other = [x; MYSTERY];

    [x; 1]
}