| 1 |
/* PR tree-optimization/116024 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O1 -fdump-tree-forwprop1-details" } */ |
| 4 |
|
| 5 |
#include <stdint.h> |
| 6 |
|
| 7 |
uint32_t f(void); |
| 8 |
|
| 9 |
int32_t i3(void) |
| 10 |
{ |
| 11 |
uint32_t l = 10 + (uint32_t)f(); |
| 12 |
return l <= 9; // f() >= -10u |
| 13 |
} |
| 14 |
|
| 15 |
int32_t i3a(void) |
| 16 |
{ |
| 17 |
uint32_t l = 20 + (uint32_t)f(); |
| 18 |
return l < 20; // f() > -21u |
| 19 |
} |
| 20 |
|
| 21 |
int32_t i3b(void) |
| 22 |
{ |
| 23 |
uint32_t l = 30 + (uint32_t)f(); |
| 24 |
return l >= 30; // f() <= -31u |
| 25 |
} |
| 26 |
|
| 27 |
int32_t i3c(void) |
| 28 |
{ |
| 29 |
uint32_t l = 40 + (uint32_t)f(); |
| 30 |
return l > 39; // f() < -39u |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-tree-dump-times "Removing dead stmt:.*? \\+" 4 "forwprop1" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 4294967285" 1 "forwprop1" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 4294967275" 1 "forwprop1" } } */ |
| 36 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* <= 4294967265" 1 "forwprop1" } } */ |
| 37 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* <= 4294967255" 1 "forwprop1" } } */ |