blob: 8062eb19b1136a03e6a8bb431669743f0938db5a (
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
|
/* { dg-do compile } */
/* PR treee-optimization/114894 */
/* Phi-OPT should be able to optimize these without sinking being invoked. */
/* { dg-options "-O -fdump-tree-phiopt2 -fdump-tree-phiopt3 -fdump-tree-optimized -fno-tree-sink" } */
int fmul1(int a, int b)
{
int c = a * b;
if (a != 0)
return c;
return 0;
}
int fand1(int a, int b)
{
int c = a & b;
if (a != 0)
return c;
return 0;
}
void g(int);
int fdiv1(int a, int b)
{
int d = b|1;
g(d);
int c = a / d;
return a != 0 ? c : 0;
}
/* fdiv1 requires until later than phiopt2 to be able to detect that
d is non-zero. to be able to remove the conditional. */
/* { dg-final { scan-tree-dump-times "goto" 2 "phiopt2" } } */
/* { dg-final { scan-tree-dump-not "goto" "phiopt3" } } */
/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */
|