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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |aldyh at gcc dot gnu.org
      Known to fail|                            |13.0
      Known to work|                            |12.2.1
     Ever confirmed|0                           |1
           Priority|P3                          |P1
   Last reconfirmed|                            |2022-12-21

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Same with -O2.

Visiting conditional with predicate: if (c_13 != 0)

With known ranges 
        c_13: [irange] int [-INF, +INF] NONZERO 0x3

Predicate evaluates to: DON'T KNOW
Not folded

vs. handling the cycle PHI for c:

  <bb 2> [local count: 118111600]:
  b = 0;
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 955630225]:
  _1 = c_10 ^ 3;
  _2 = b.1_3 + 1;
  b = _2;

  <bb 4> [local count: 1073741824]:
  # c_10 = PHI <1(2), _1(3)>
  b.1_3 = b;
  if (b.1_3 <= 8)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]

  <bb 5> [local count: 118111600]:
  # c_13 = PHI <c_10(4)>
  if (c_13 != 0)

Value ranges after VRP:

_1: int [1, 2]
c_2: int [1, 2]


this is yet another case where proper propagation is important.  I'm
questioning the idea that on-demand ranger is a good solution and replacing
VRP1 was premature?  I'm asking again as to what the plan was for cases like
this?

bit-CCP propagation arrives with

Simulating statement: c_10 = PHI <1(2), _1(3)>

Visiting PHI node: c_10 = PHI <1(2), _1(3)>
        Argument #0 (2 -> 4 executable)
        1       Value: CONSTANT 1
        Argument #1 (3 -> 4 executable)
        _1      Value: CONSTANT 0x0 (0x3)

    PHI node value: CONSTANT 0x0 (0x3)

but it doesn't know that always either bit zero or one is set.

Reply via email to