| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fno-trapping-math -fdump-tree-ifcombine-details-blocks" } */ |
| 3 |
|
| 4 |
void f (); |
| 5 |
enum Sign { NEG=-1, ZERO, POS }; |
| 6 |
|
| 7 |
static inline enum Sign sign (double x) |
| 8 |
{ |
| 9 |
if (x > 0) return POS; |
| 10 |
if (x < 0) return NEG; |
| 11 |
return ZERO; |
| 12 |
} |
| 13 |
void g (double x) |
| 14 |
{ |
| 15 |
if (sign (x) == NEG) f(); |
| 16 |
} |
| 17 |
|
| 18 |
/* The above should be optimized to x < 0 by ifcombine. |
| 19 |
The transformation would also be legal with -ftrapping-math. */ |
| 20 |
|
| 21 |
/* { dg-final { scan-tree-dump "optimizing.* < " "ifcombine" } } */ |
| 22 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "ifcombine" } } */ |