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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-12-08
                 CC|                            |dbarboza at ventanamicro dot 
com
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Lots of places this could probably be implemented.   In the first case we want
to realize that we have a PHI feeding a comparison:


  # c_1 = PHI <a_3(D)(2), 0B(3)>
  _7 = c_1 != 0B; 

We don't really care about the value in a_3, just whether it is nonzero in both
paths.  I would expect ranger to globally record its range as being nonzero.

In second case:

  b_3 = *a_2(D);
  tt_5 = b_3 != 0;
  c_6 = tt_5 ? a_2(D) : 0B;
  tt_7 = c_6 != 0B;

Same basically applies there, we just happened to have already optimized away
the PHI.

I think if we got the first case if-converted into the second form, then we
could focus on exploiting the nonzero status of "a" to simplify further rather
than trying to handle it in two different paths.

Reply via email to