[Bug middle-end/126896] backward threader cannot duplicate a PHI-of-compares join block

"rguenth at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126896

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-17
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
To clarify, DOM turns

  <bb 2> [local count: 1073741824]:
  if (x_3(D) != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870912]:
  t_9 = a_7(D) < b_8(D);
  goto <bb 5>; [100.00%]

  <bb 4> [local count: 536870912]:
  t_6 = c_4(D) < d_5(D);

  <bb 5> [local count: 1073741824]:
  # t_1 = PHI <t_9(3), t_6(4)>
  if (t_1 != 0)
    goto <bb 6>; [33.00%]
  else
    goto <bb 7>; [67.00%]

  <bb 6> [local count: 354334800]:
  g ();

  <bb 7> [local count: 1073741824]:
  return;

into

  <bb 2> [local count: 1073741824]:
  if (x_3(D) != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870912]:
  t_9 = a_7(D) < b_8(D);
  if (t_9 != 0)
    goto <bb 5>; [0.00%]
  else
    goto <bb 6>; [100.00%]

  <bb 4> [local count: 536870912]:
  t_6 = c_4(D) < d_5(D);
  if (t_6 != 0)
    goto <bb 5>; [66.00%]
  else
    goto <bb 6>; [34.00%]

  <bb 5> [local count: 354334800]:
  g ();

  <bb 6> [local count: 1073741824]:
  return;


This isn't jump threading.  It looks more like sth for phiopt or tail
duplication?

 t_9 = a_7(D) < b_8(D);
..
 t_6 = c_4(D) < d_5(D);
..
 # t_1 = PHI <t_9, t_6>
 if (t_1 != 0)


I suspect there's some odd special case code in DOM to register this as
"jump thread" just to get the if (t != 0) block duplicated.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.