1 /* { dg-do compile } */
2 /* { dg-options "-S -O2 -ftree-vectorize -fdump-tree-ifcvt-stats-blocks-details" { target *-*-* } } */
3 
4 double
foo(const char * u,const char * v,long n)5 foo (const char *u, const char *v, long n)
6 {
7   long i, n1 = 0, n2 = 0;
8 
9   for (i = 0; i < n; i++)
10     {
11       n2 += (u[i] && !v[i]);
12       n1 += (!u[i] && v[i]);
13     }
14   return (2.0 * n2 * n1);
15 }
16 
17 /* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
18 
19 /* We insert into code
20    if (LOOP_VECTORIZED (...))
21    which is folded by vectorizer.  Both outgoing edges must have probability
22    100% so the resulting profile match after folding.  */
23 /* { dg-final { scan-tree-dump-times "Invalid sum of outgoing probabilities 200.0" 1 "ifcvt" } } */
24 /* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 1 "ifcvt" } } */
25