https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102072

--- Comment #7 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
For this case: it was generated as:
  l_12 = l_25 + 1;
  if (l_12 > n_13(D))

Here: cmp is ">", bound is "n_13", and "iv(base=l_xx, step=1)".
This hits the assert in determine_exit_conditions.

For members of tree_niter_desc, the comments(as below) align with the asserts
in determine_exit_conditions. 
------------
  /* The simplified shape of the exit condition.  The loop exits if             
     CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,                   
     LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is             
     LE_EXPR and negative if CMP is GE_EXPR.  This information is used          
     by loop unrolling.  */
  affine_iv control;
  tree bound;
  enum tree_code cmp;


Current code the "control, bound and cmp" are set in number_of_iterations_lt:
    if (integer_nonzerop (iv0->step))
      {  
        niter->control = *iv0;
        niter->cmp = LT_EXPR;
        niter->bound = iv1->base;
      }
    else
      {
        niter->control = *iv1;
        niter->cmp = GT_EXPR;
        niter->bound = iv0->base;
      }
This code may need to refine for the case "step until wrap condition".

Reply via email to