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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
            Summary|Missed loop optimization    |Missed VRP optimization

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that VRP doesn't handle

  <bb 3>:
  q_13 = ASSERT_EXPR <q_1, q_1 < r_6(D)>;
  if (q_13 == c_3)
    goto <bb 4>;

given

Visiting PHI node: c_3 = PHI <r_6(D)(2), c_2(5)>
    Argument #0 (2 -> 6 executable)
        r_6(D): [r_6(D), r_6(D)]
    Argument #1 (5 -> 6 not executable)
Found new range for c_3: [r_6(D), r_6(D)]

Visiting statement:
q_13 = ASSERT_EXPR <q_1, q_1 < r_6(D)>;
Applying pattern match.pd:771, generic-match.c:64
Applying pattern match.pd:808, generic-match.c:12425
Intersecting
  [0, r_6(D) + 4294967295]  EQUIVALENCES: { q_1 } (1 elements)
and
  [0, 0]
Applying pattern match.pd:2599, generic-match.c:1227
Applying pattern match.pd:2605, generic-match.c:1267
Applying pattern match.pd:3337, generic-match.c:5047
Applying pattern match.pd:2599, generic-match.c:1227
Applying pattern match.pd:2605, generic-match.c:1267
Applying pattern match.pd:3337, generic-match.c:5047
to
  [0, r_6(D) + 4294967295]  EQUIVALENCES: { q_1 } (1 elements)
Found new range for q_13: [0, r_6(D) + 4294967295]

Visiting statement:
if (q_13 == c_3)
Visiting conditional with predicate: if (q_13 == c_3)

With known ranges
        q_13: [0, r_6(D) + 4294967295]  EQUIVALENCES: { q_1 } (1 elements)     
c_3: [r_6(D), r_6(D)]

Predicate evaluates to: DON'T KNOW


VRP doesn't have a good way to represent symbolic inequality relations as
range.  To solve this issue VRP has to evaluate q_13 == c_3 as false.

I suppose one way may have been to add an assert for r_6(D) as well which
is known to be != 0 here.  But of course r_6(D) is not "live-on-edge",
it's live only through c_3s value-range.

Note that w/o the PHI for c (the c *= 2 stmt removed) DOM and other passes
can handle this just fine.

Reply via email to