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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
  <bb 2> [local count: 118111600]:
  c_lsm.6_7 = c;
  niters.8_1 = -c_lsm.6_7;
  if (c_lsm.6_7 > 240)
    goto <bb 11>; [10.00%]
  else
    goto <bb 6>; [90.00%]

  <bb 6> [local count: 106300440]:
  _18 = niters.8_1 + 240;
  _19 = _18 >> 4;
  # RANGE [1, 15] NONZERO 15
  bnd.9_17 = _19 + 1;

but here c == 0 and thus _19 + 1 is 16.  The number of latch invocations is 255
but the number of iterations is that + 1 and thus zero in the IVs type.  This
is why we have num_itersm1 and so I guess

      /* Peeling algorithm guarantees that vector loop bound is at least ONE,
         we set range information to make niters analyzer's life easier.  */
      if (stmts != NULL && log_vf)
        set_range_info (niters_vector, VR_RANGE,
                        wi::to_wide (build_int_cst (type, 1)),
                        wi::to_wide (fold_build2 (RSHIFT_EXPR, type,
                                                  TYPE_MAX_VALUE (type),
                                                  log_vf)));

needs to use TYPE_MAX_VALUE + 1 >> log_vf here to be on the safe side for the
"non-representable" niter value.

Reply via email to