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

Andrew Macleod <amacleod at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #1 from Andrew Macleod <amacleod at redhat dot com> ---
  t_5 = b_3(D) - a_4(D);
  if (t_5 == 1)
    goto <bb 3>; [INV] 
  else 
    goto <bb 5>; [INV]

  <bb 3> :
  foo (1);
  _1 = a_4(D) + 1;
  if (_1 != b_3(D))
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]


This sort of algebraic reasoning is beyond what we can do with just ranges and
relations.   We can determine basic relations, ie that in BB3 we could
determine that b_3 > a_4, but not that b_3 is a_4 + 1

What exactly do we have for expression adjustments and comparisons in fold or
match and compare, or elsewhere?

it could be possible to create a new kind of relation, maybe VREL_EXPR, that
could be generated by operator_minus (and other operations) when the LHS is a
singleton.   On edge 2->3  is could create a relation VREL_EXPR between b_3 and
a_4 with an expressions something like b_3 = a_4 + LHS     , which would come
out as b_3 - a_4 + 1

The dependency info is available to determine that _1 uses a_4, so we can
figure out to look for that relation when we evaluate _1 != b_3 .    we'd then
need to be able to "fold" that expression b_3s relation ompared to _1's
expression  .  ie    a_4 + 1 !=  a_4 + 1   

There may be alternative ways to use the info if it was created, but As things
currently stand, VRP cannot determine this algebraic simplification.

Reply via email to