PR target/64159
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-dom-cse-2.c
blobf767a316e93e8c8a4fd6777cdd7837c73a67bae5
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-tree-fre -fno-tree-pre -fdump-tree-optimized" } */
4 int
5 foo ()
7 const int a[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
8 int i, sum;
10 sum = 0;
11 for (i = 0; i < sizeof (a) / sizeof (*a); i++)
12 sum += a[i];
14 return sum;
17 /* After late unrolling the above loop completely DOM should be
18 able to optimize this to return 28. */
20 /* See PR63679 and PR64159, if the target forces the initializer to memory then
21 DOM is not able to perform this optimization. */
23 /* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail hppa*-*-* powerpc*-*-* sparc*-*-*} } } */
24 /* { dg-final { cleanup-tree-dump "optimized" } } */