111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-fgnu-tm -O1 -fdump-tree-lim2" } */
|
|
3
|
|
4 /* Test that thread visible loads do not get hoisted out of loops if
|
|
5 the load would not have occurred on each path out of the loop. */
|
|
6
|
|
7 int x[10] = {0,0,0,0,0,0,0,0,0,0};
|
|
8 int DATA_DATA = 0;
|
|
9
|
|
10 void reader()
|
|
11 {
|
|
12 int i;
|
|
13 __transaction_atomic
|
|
14 {
|
|
15 for (i = 0; i < 10; i++)
|
|
16 if (x[i])
|
|
17 x[i] += DATA_DATA;
|
|
18 /* If we loaded DATA_DATA here, we could hoist it before the loop,
|
|
19 but since we don't... we can't. */
|
|
20 }
|
|
21 }
|
|
22
|
|
23 /* { dg-final { scan-tree-dump-times "Cannot hoist.*DATA_DATA because it is in a transaction" 1 "lim2" } } */
|