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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Richard Biener from comment #1)
> For the failing case we see
> 
>   <bb 2> :
>   if (c_5(D) == s_6(D))
>     goto <bb 3>; [INV]
>   else
>     goto <bb 6>; [INV]
> 
>   <bb 3> :
>   if (c_5(D) != 0)
>     goto <bb 6>; [INV]
>   else
>     goto <bb 4>; [INV]
> 
>   <bb 4> :
>   if (s_6(D) != 0)
>     goto <bb 5>; [INV]
>   else
>     goto <bb 6>; [INV]
> 
> and we basically fail to thread 2->3->4->6, eliminating the if (s_6(D) != 0)
> branch when c_5(D) == s_6(D) and c_5(D) == 0.
> 
> It looks like relations / equivalences related, but maybe not exactly. 
> Andrew?

it is related.  Due to the expense, we don't evaluate every equivalence at
every use point.  In this case, there was no obvious "trigger" when we see s_6
!= 0 to go query all of the equivalences to see if they have ranges.

However range_from_dom ()  is now quite efficient and has a "read-only" mode
where it will make a DOM query without filling the cache. I am experimenting
with having the on-entry cache fill also invoke range_from_dom on equivalences
in read-only mode to see if any existing equivalence value can improve the
range.

The initial protoype reduces that test case in EVRP from
 <bb 2> :
  _1 = ~c_7(D);
  _2 = (int) _1;
  _3 = ~s_8(D);
  _4 = (int) _3;
  if (c_7(D) == s_8(D))
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  if (c_7(D) != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 4> :
  if (s_8(D) != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  DCEMarker0_ ();

  <bb 6> :
  return;

 to

   <bb 2> :
  _1 = ~c_7(D);
  _2 = (int) _1;
  _3 = ~s_8(D);
  _4 = (int) _3;
  return;


Let me run some performance numbers and see what the result is to see if there
is any throtteling needed or not.

Reply via email to