| 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 i2(void) |
| 10 |
{ |
| 11 |
uint32_t l = 10 - (uint32_t)f(); |
| 12 |
return l <= 20; // f() + 10 <= 20 |
| 13 |
} |
| 14 |
|
| 15 |
int32_t i2a(void) |
| 16 |
{ |
| 17 |
uint32_t l = 10 - (uint32_t)f(); |
| 18 |
return l < 30; // f() + 19 < 30 |
| 19 |
} |
| 20 |
|
| 21 |
int32_t i2b(void) |
| 22 |
{ |
| 23 |
uint32_t l = 200 - (uint32_t)f(); |
| 24 |
return l <= 100; // f() - 100 <= 100 |
| 25 |
} |
| 26 |
|
| 27 |
int32_t i2c(void) |
| 28 |
{ |
| 29 |
uint32_t l = 300 - (uint32_t)f(); |
| 30 |
return l < 100; // f() - 201 < 100 |
| 31 |
} |
| 32 |
|
| 33 |
int32_t i2d(void) |
| 34 |
{ |
| 35 |
uint32_t l = 1000 - (uint32_t)f(); |
| 36 |
return l >= 2000; // f() + 999 >= 2000 |
| 37 |
} |
| 38 |
|
| 39 |
int32_t i2e(void) |
| 40 |
{ |
| 41 |
uint32_t l = 1000 - (uint32_t)f(); |
| 42 |
return l > 3000; // f() + 2000 > 3000 |
| 43 |
} |
| 44 |
|
| 45 |
int32_t i2f(void) |
| 46 |
{ |
| 47 |
uint32_t l = 20000 - (uint32_t)f(); |
| 48 |
return l >= 10000; // f() - 10001 >= 10000 |
| 49 |
} |
| 50 |
|
| 51 |
int32_t i2g(void) |
| 52 |
{ |
| 53 |
uint32_t l = 30000 - (uint32_t)f(); |
| 54 |
return l > 10000; // f() - 20000 > 10000 |
| 55 |
} |
| 56 |
|
| 57 |
/* { dg-final { scan-tree-dump-times "Removing dead stmt:.*?- _" 8 "forwprop1" } } */ |
| 58 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 10.*\n.*<= 20" 1 "forwprop1" } } */ |
| 59 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 19.*\n.*<= 29" 1 "forwprop1" } } */ |
| 60 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294967196.*\n.*<= 100" 1 "forwprop1" } } */ |
| 61 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294967095.*\n.*<= 99" 1 "forwprop1" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 999.*\n.*> 1999" 1 "forwprop1" } } */ |
| 63 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 2000.*\n.*> 3000" 1 "forwprop1" } } */ |
| 64 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294957295.*\n.*> 9999" 1 "forwprop1" } } */ |
| 65 |
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294947296.*\n.*> 10000" 1 "forwprop1" } } */ |