aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/minmax-25.c
blob: b7a5bfd4c19326a2d91ceaf287318221fd6e43d5 (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 "-O1 -fdump-tree-optimized -fdump-tree-original" } */
/* PR tree-optimization/111349 */

int f();
int g();

int test1(int a, int b)
{
        return (a > b) ? ((a > b) ? a : b) : a;
}

int test1_(int a, int b)
{
        return (b < a) ? ((a > b) ? a : b) : a;
}

/* test1 and test1_ should be able to optimize to `return a;` during fold.  */
/* { dg-final { scan-tree-dump-times "return a;" 2 "original" } } */
/* { dg-final { scan-tree-dump-not " MAX_EXPR " "original" } } */
/* { dg-final { scan-tree-dump-times "return a" 2 "optimized" } } */