Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-14.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-lim-details" } */
3
4 extern void abort();
5
6 typedef int A;
7 typedef float B;
8
9 void __attribute__((noinline,noclone))
10 foo(A * p, B *r, long unk, long oh)
11 {
12 for (long i = 0; i < unk; ++i) {
13 *p = 1;
14 *r = 2;
15 if (oh & i)
16 break;
17 *r = 3;
18 *p = 4;
19 }
20 }
21
22 int main(void)
23 {
24 union { A x; B f; } u;
25 foo(&u.x, &u.f, 1, 1);
26 if (u.x != 4) abort();
27 foo(&u.x, &u.f, 2, 1);
28 if (u.f != 2) abort ();
29 return 0;
30 }
31
32 /* { dg-final { scan-tree-dump "Executing store motion of \\*p" "lim2" } } */
33 /* { dg-final { scan-tree-dump "Executing store motion of \\*r" "lim2" } } */