blob: 91cb6a7c4f14a57dadca45f8bea975a76017dd55 (
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
|
/* PR tree-optimization/116024 */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-forwprop1-details" } */
#include <stdint.h>
uint32_t f(void);
int32_t i2(void)
{
uint32_t l = 10 - (uint32_t)f();
return l <= 20; // f() + 10 <= 20
}
int32_t i2a(void)
{
uint32_t l = 10 - (uint32_t)f();
return l < 30; // f() + 19 < 30
}
int32_t i2b(void)
{
uint32_t l = 200 - (uint32_t)f();
return l <= 100; // f() - 100 <= 100
}
int32_t i2c(void)
{
uint32_t l = 300 - (uint32_t)f();
return l < 100; // f() - 201 < 100
}
int32_t i2d(void)
{
uint32_t l = 1000 - (uint32_t)f();
return l >= 2000; // f() + 999 >= 2000
}
int32_t i2e(void)
{
uint32_t l = 1000 - (uint32_t)f();
return l > 3000; // f() + 2000 > 3000
}
int32_t i2f(void)
{
uint32_t l = 20000 - (uint32_t)f();
return l >= 10000; // f() - 10001 >= 10000
}
int32_t i2g(void)
{
uint32_t l = 30000 - (uint32_t)f();
return l > 10000; // f() - 20000 > 10000
}
/* { dg-final { scan-tree-dump-times "Removing dead stmt:.*?- _" 8 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 10.*\n.*<= 20" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 19.*\n.*<= 29" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294967196.*\n.*<= 100" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294967095.*\n.*<= 99" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 999.*\n.*> 1999" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 2000.*\n.*> 3000" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294957295.*\n.*> 9999" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "gimple_simplified to.* \\+ 4294947296.*\n.*> 10000" 1 "forwprop1" } } */
|