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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-07-02

--- Comment #17 from Martin Liška <marxin at gcc dot gnu.org> ---
Well, I'm looking at the optimized tree dump for hppa and seems fine to me:

__attribute__((noipa, noinline, noclone, no_icf))
long_richcompare (int * self, int * other, int op)
{
  int _1;
  int _2;
  int _5;
  int prephitmp_6;

  <bb 2> [local count: 1073741823]:
  _1 = yes ();
  if (_1 == 0)
    goto <bb 9>; [51.12%]
  else
    goto <bb 3>; [48.88%]

  <bb 3> [local count: 524844999]:
  _2 = yes ();
  if (_2 == 0)
    goto <bb 9>; [34.00%]
  else
    goto <bb 4>; [66.00%]

  <bb 4> [local count: 346397698]:
  if (self_11(D) == other_12(D))
    goto <bb 5>; [30.00%]
  else
    goto <bb 11>; [70.00%]

  <bb 5> [local count: 103919309]:
  switch (op_14(D)) <default: <L12> [33.33%], case 0: <L6> [16.67%], case 1:
<L14> [33.33%], case 3: <L14> [33.33%], case 5: <L34> [16.67%]>

  <bb 6> [local count: 17319885]:
<L34>:
  goto <bb 10>; [100.00%]

  <bb 7> [local count: 115465900]:
  # prephitmp_6 = PHI <1(5), op_14(D)(11)>
<L6>:
  goto <bb 10>; [100.00%]

  <bb 8> [count: 0]:
<L12>:
  __builtin_unreachable ();

  <bb 9> [local count: 727344125]:

  <bb 10> [local count: 1073741824]:
  # _5 = PHI <1(6), prephitmp_6(7), 0(9), 0(5), 0(11)>
<L14>:
  return _5;

  <bb 11> [local count: 242478389]:
  switch (op_14(D)) <default: <L12> [33.33%], case 0: <L6> [16.67%], case 1:
<L14> [50.00%], case 3: <L14> [50.00%], case 5: <L14> [50.00%]>

}

we go to bb_2, then as yes() == 0 is false, to bb_3 and bb_4.
In bb_4 we jump to bb_11, from which we go to L6 (aka bb_7).
# prephitmp_6 = PHI <1(5), op_14(D)(11)>

here we set prephitmp_6 = op_14 = 0;
go to bb_10, here _5 = prephitmp_6 = 0;
return _5. So the function properly returns 0.

For me tree optimized dump is correct, so likely a target issue.

@Sergei: Is GCC 9 working properly?
Would it be possible to bisect that?

Reply via email to