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

--- Comment #4 from Paul Menzel <pmenzel+gcc at molgen dot mpg.de> ---
(In reply to Richard Biener from comment #1)
>   <bb 2> [local count: 1073741824]:
>   _13 = (sizetype) k_6(D);
>   _14 = _13 * 512;
>   _15 = _14 + 8;
>   p_7 = s_5(D) + _15;
>   r_9 = s_5(D)->rc.range;
>   _1 = (long unsigned int) i_10(D);
>   _2 = _1 * 2;
>   _3 = p_7 + _2;
>   *_3 = 1;
>   _4 = s_5(D)->rc.range;
>   _12 = r_9 - _4;
>   return _12;
> 
> we are not unleashing full data reference analysis on *_3 during
> value-numbering, we'd have to conclude that 8 + k * 512 + 2 * i is never zero
> and in particular bigger than 3 or less than -3.  But with k == 0 and i == 
> -4U 
> it is zero.

Indeed, but doesn’t it also depend on the width of sizetype?

With r17-6554-g54805df7d2f on powerpc64le, the loop body in the optimized dump
is

  _3 = s_17(D)->rc.range;
  _4 = _3 >> 11;
  _5 = *p_21;
  _6 = (unsigned int) _5;
  bound_22 = _4 * _6;
  s_17(D)->rc.range = bound_22;
  _7 = *p_21;
  ...
  *p_21 = _12;

So s->rc.range is loaded and stored in every iteration (the missing store
motion from comment #3), and *p_21 is loaded twice around the store to
s->rc.range.  The second load is the f1 problem again.

(Assisted-by claude-opus-5.5)

Reply via email to