Debian Codegraph @

gcc/testsuite/gcc.dg/ipa/pr91088.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-cp-details -fno-inline" } */
3
4 int foo();
5
6 #define large_code \
7 do { \
8 foo (); \
9 foo (); \
10 foo (); \
11 foo (); \
12 foo (); \
13 foo (); \
14 foo (); \
15 foo (); \
16 foo (); \
17 foo (); \
18 foo (); \
19 foo (); \
20 foo (); \
21 foo (); \
22 foo (); \
23 foo (); \
24 foo (); \
25 foo (); \
26 foo (); \
27 foo (); \
28 foo (); \
29 foo (); \
30 foo (); \
31 foo (); \
32 foo (); \
33 foo (); \
34 foo (); \
35 foo (); \
36 foo (); \
37 foo (); \
38 foo (); \
39 foo (); \
40 foo (); \
41 foo (); \
42 foo (); \
43 foo (); \
44 foo (); \
45 foo (); \
46 foo (); \
47 foo (); \
48 } while (1)
49
50
51 struct A
52 {
53 char f1;
54 short f2 : 5;
55 int f3;
56 };
57
58 int callee1 (struct A a)
59 {
60 if ((a.f2 + 7) & 17)
61 foo ();
62
63 if ((1300 / (short)a.f3) == 19)
64 large_code;
65
66 return 1;
67 }
68
69 int callee2 (short *p)
70 {
71 if ((*p ^ 1) < 8)
72 large_code;
73
74 return 2;
75 }
76
77 int callee3 (int v)
78 {
79 if ((27 % ((1 - (v & 0xff)) * 3)) < 6)
80 {
81 large_code;
82 return v + 2;
83 }
84 else
85 return v + 1;
86 }
87
88 int caller ()
89 {
90 struct A a;
91 short b;
92
93 a.f2 = -7;
94 a.f3 = 68;
95 if (callee1 (a))
96 foo ();
97
98 a.f2 = 3;
99 a.f3 = 10;
100 if (callee1 (a))
101 foo ();
102
103 b = 9;
104 if (callee2 (&b))
105 foo ();
106
107 b = 2;
108 if (callee2 (&b))
109 foo ();
110
111 return callee3 (-5) +
112 callee3 (0);
113 }
114
115 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee1" 1 "cp" } } */
116 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee2" 1 "cp" } } */
117 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee3" 1 "cp" } } */
118 /* { dg-final { scan-ipa-dump "op0\\\[offset: 16],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target default_packed } } } */
119 /* { dg-final { scan-ipa-dump "op0\\\[offset: 32],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target { ! default_packed } } } } */
120 /* { dg-final { scan-ipa-dump "op0\\\[ref offset: 0],\\(# \\^ 1\\) <" "cp" } } */
121 /* { dg-final { scan-ipa-dump "op0,\\(# & 255\\),\\(1 - #\\),\\(# \\* 3\\),\\(27 % #\\) <" "cp" } } */