aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/peel-2.c
blob: 216e6552a58e3d2c210c203a88e6cdc0fc7b8e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-options "-O3 -fdump-tree-cunroll-details -fno-unroll-loops -fpeel-loops -fdump-tree-ch2-details-blocks -fno-tree-loop-distribute-patterns" } */
int a[100];
int n = 1000000;
int zeroc;
int
main()
{
	a[0]=1;
	for (int i = 0; i < n; i++)
	{
	  int j;
	  for (j = 0; a[j]; j++);
	  zeroc+=j;
	  asm __volatile__ ("":::"memory");
	}
	return 0;
}
/* { dg-final-use { scan-tree-dump "Peeled loop 2, 1 times" "cunroll" } } */
/* { dg-final-use { scan-tree-dump "Peeled likely exits: likely decreased number of iterations of loop 1" "ch2" } } */
/* { dg-final-use { scan-tree-dump "Peeled all exits: decreased number of iterations of loop 2" "ch2" } } */
/* { dg-final-use { scan-tree-dump-not "Invalid sum" "ch2" } } */