1  /* { dg-do compile } */
       2  /* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats-blocks-details" { target *-*-* } } */
       3  
       4  #include <stdarg.h>
       5  
       6  #define N 16
       7  #define MAX 42
       8  
       9  int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
      10  
      11  extern void abort(void); 
      12  
      13  int main1 ()
      14  {  
      15    int i, j;
      16  
      17    for (i = 0; i < N; i++)
      18      {
      19        j = A[i];
      20        A[i] = ( j >= MAX ? MAX : 0); 
      21      }
      22  
      23    /* check results:  */
      24    for (i = 0; i < N; i++)
      25      {
      26        if (A[i] > MAX)
      27  	abort ();
      28      }
      29  
      30    return 0;
      31  }
      32  
      33  
      34  
      35  /* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
      36  
      37  /* We insert into code
      38     if (LOOP_VECTORIZED (...))
      39     which is folded by vectorizer.  Both outgoing edges must have probability
      40     100% so the resulting profile match after folding.  */
      41  /* { dg-final { scan-tree-dump-times "Invalid sum of outgoing probabilities 200.0" 1 "ifcvt" } } */
      42  /* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 2 "ifcvt" } } */