blob: 6efa0c2f916fa053b48f897f9c806e086e3541b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* PR tree-optimization/116024 */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-forwprop1-details" } */
#include <stdint.h>
#include <limits.h>
uint32_t f(void);
int32_t i1(void)
{
int32_t l = 10 - (int32_t)f();
return l <= 9; // f() > 0
}
int32_t i1a(void)
{
int32_t l = 20 - (int32_t)f();
return l <= INT32_MIN; // return 0
}
int32_t i1b(void)
{
int32_t l = 30 - (int32_t)f();
return l <= INT32_MIN + 31; // f() == INT32_MAX
}
int32_t i1c(void)
{
int32_t l = INT32_MAX - 40 - (int32_t)f();
return l <= -38; // f() > INT32_MAX - 3
}
int32_t i1d(void)
{
int32_t l = INT32_MAX - 50 - (int32_t)f();
return l <= INT32_MAX - 1; // f() != -50
}
int32_t i1e(void)
{
int32_t l = INT32_MAX - 60 - (int32_t)f();
return l != INT32_MAX - 90; // f() != 30
}
int32_t i1f(void)
{
int32_t l = INT32_MIN + 70 - (int32_t)f();
return l <= INT32_MAX - 2; // return 0
}
int32_t i1g(void)
{
int32_t l = INT32_MAX/2 + 30 - (int32_t)f();
return l <= INT32_MIN/2 - 30; // return 1
}
/* { dg-final { scan-tree-dump-times "Removing dead stmt:.*?- _" 5 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "return 0" 2 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "return 1" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 0" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* == 2147483647" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 2147483644" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* != 4294967246" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* != 30" 1 "forwprop1" } } */
|