blob: fe29e841f283d781cc6cfabb73e1784efdccaa07 (
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
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-lim2-details" } */
/* Test that `data' and 'data1' is not hoisted out of inner loop and outer loop
when it is in cold loop. */
int count;
volatile int x;
struct obj {
int data;
int data1;
struct obj *next;
};
void
func (int m, int n, int k, struct obj *a)
{
struct obj *q = a;
for (int j = 0; j < n; j++)
if (__builtin_expect (m, 0))
for (int i = 0; i < m; i++)
{
if (__builtin_expect (x, 0))
{
count++;
q->data += 3; /* Not hoisted out to inner loop. */
}
count += n;
q->data1 += k; /* Not hoisted out to outer loop. */
}
}
/* { dg-final { scan-tree-dump "Executing store motion of count from loop 2" "lim2" } } */
/* { dg-final { scan-tree-dump "Executing store motion of \[^ \]*data1 from loop 2" "lim2" } } */
/* { dg-final { scan-tree-dump-times "Executing store motion of" 2 "lim2" } } */
|