Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-lim2-details" } */
3
4 /* Test that `data' and 'data1' is not hoisted out of inner loop and outer loop
5 when it is in cold loop. */
6
7 int count;
8 volatile int x;
9
10 struct obj {
11 int data;
12 int data1;
13 struct obj *next;
14 };
15
16 void
17 func (int m, int n, int k, struct obj *a)
18 {
19 struct obj *q = a;
20 for (int j = 0; j < n; j++)
21 if (__builtin_expect (m, 0))
22 for (int i = 0; i < m; i++)
23 {
24 if (__builtin_expect (x, 0))
25 {
26 count++;
27 q->data += 3; /* Not hoisted out to inner loop. */
28 }
29 count += n;
30 q->data1 += k; /* Not hoisted out to outer loop. */
31 }
32 }
33
34 /* { dg-final { scan-tree-dump "Executing store motion of count from loop 2" "lim2" } } */
35 /* { dg-final { scan-tree-dump "Executing store motion of \[^ \]*data1 from loop 2" "lim2" } } */
36 /* { dg-final { scan-tree-dump-times "Executing store motion of" 2 "lim2" } } */