public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* spaceship_replacement cannot see through simplified set of FP conditionals
@ 2022-07-29 11:40 Aldy Hernandez
  2022-07-29 11:49 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2022-07-29 11:40 UTC (permalink / raw)
  To: Jakub Jelinek, GCC Mailing List

Hi.

With my upcoming patch enabling floating point VRP,
g++.dg/opt/pr94589-2.C is failing:

https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598788.html

The problem is that phiopt no longer sees the following snippet,
because we have folded away the final conditional as true:

bool f5 (double i, double j)
{
  signed char __v$_M_value;
  signed char c$_M_value;
  bool D.8519;
  struct partial_ordering __v;
  struct partial_ordering c;
  unsigned int _11;
  bool _16;

  <bb 2> :
  if (i_2(D) != j_4(D))
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  if (i_2(D) >= j_4(D))
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 4> :
  if (i_2(D) > j_4(D))
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :

  <bb 6> :
  # c$_M_value_3 = PHI <-1(3), 0(2), 2(5), 1(4)>
  _11 = (unsigned int) c$_M_value_3;
  _16 = _11 <= 1;
  return _16;
}

This means that spaceship_replacement()  now sees one less argument to the PHI:

  <bb 2> :
  if (i_2(D) != j_4(D))
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  if (i_2(D) >= j_4(D))
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :

  <bb 5> :
  # c$_M_value_3 = PHI <-1(3), 0(2), 1(4)>

...and we bail because we are expecting 4 arguments:

      if (EDGE_COUNT (phi_bb->preds) != 4)
    return false;

Could someone give me a hand here? Can spaceship_replacement easily be
adapted to handle this case, or should we be simplifying this
elsewhere?

Thanks.
Aldy


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-29 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 11:40 spaceship_replacement cannot see through simplified set of FP conditionals Aldy Hernandez
2022-07-29 11:49 ` Jakub Jelinek
2022-07-29 11:51   ` Aldy Hernandez
2022-07-29 11:57     ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).