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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so the reason is that we value-number tmp_46 in

<bb 3> [local count: 482002707]:
if (0 != 0)
  goto <bb 5>; [33.00%]
else
  goto <bb 4>; [67.00%]

<bb 4> [local count: 322941815]:
tmp_5 = .DEFERRED_INIT (1, 2, &"tmp"[0]);
...
goto <bb 6>;

<bb 5> [local count: 159060893]:
...
tmp_2 = .DEFERRED_INIT (1, 2, &"tmp"[0]);
...

tmp_46 = PHI <tmp_5(4), tmp_2(5)>

to tmp_2 because we use ssa_undefined_value_p () to check whether we are
dealing with an undefined value.  And that returns true for tmp_5.  This
makes us pick tmp_2 which we treat as VARYING since we didn't visit it
and we don't trust the not-executable state of its incoming edge (a missed
optimization, guess I can look at that as well).  tmp_2 is also considered
undefined.  We then have

  /* If we saw only undefined values and VN_TOP use one of the
     undefined values.  */
  else if (sameval == VN_TOP)
    result = seen_undef ? seen_undef : sameval;

and "one of" puts us in an unlucky situation here.

I do have a sensible fix around this I think.

Reply via email to