1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */
9 unsigned int x
, y
, idx
, H
= 1024, W
= 1024;
11 int * tmps
= (int *)malloc(H
*W
*sizeof(int));
13 /* This loop gets parallelized even though output dependences exist
14 between writes to 'tmps' that prevent parallelization.
15 For example: tmps[1] = 1, ..., tmps[1] = 17. */
17 for(x
= 1; x
< H
; x
++)
19 for(y
= 1; y
< W
; y
++)
22 tmps
[idx
% 4096] = idx
;
26 for(x
= 1; x
< 8; x
++)
27 printf("tmps[%d]=%d\n", x
, tmps
[x
]);
31 /* Check that no loop gets parallelized. */
33 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops" } } */
34 /* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */
35 /* { dg-final { cleanup-tree-dump "parloops" } } */
36 /* { dg-final { cleanup-tree-dump "optimized" } } */