aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/pr57380.C
blob: 0a2b2ad5f5534d6a492a364adf69be2fd948c93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-phiopt1" } */

struct my_array {
    int data[4];
};

const int& my_max(const int& a, const int& b) {
    return a < b ? b : a;
}

int f(my_array a, my_array b) {
    int res = 0;
    for (int i = 0; i < 4; ++i) {
	res += my_max(a.data[i], b.data[i]);
    }
    return res;
}

/* { dg-final { scan-tree-dump "MAX_EXPR" "phiopt1" } } */
/* { dg-final { cleanup-tree-dump "phiopt1" } } */