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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |tree-optimization

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Looking into this further we have this:
```
  <bb 30> [local count: 194512185]:
  if (_48 > _52)
    goto <bb 31>; [39.28%]
  else
    goto <bb 33>; [60.72%]

  <bb 31> [local count: 76412788]:
  if (_49 > _53)
    goto <bb 56>; [41.00%]
  else
    goto <bb 32>; [59.00%]

  <bb 56> [local count: 31329243]: // _63, _56, _57, _62, 312, 247, 252, 257
  goto <bb 40>; [100.00%]

  <bb 32> [local count: 45083545]: // _63, _56, _61, _62, 312, 247, 252, 257
  goto <bb 40>; [100.00%]

  <bb 33> [local count: 118099397]:
  if (_49 > _53)
    goto <bb 57>; [41.00%]
  else
    goto <bb 34>; [59.00%]

  <bb 57> [local count: 48420752]: // _63, _60, _57, _62, 312, 247, 252, 257
  goto <bb 40>; [100.00%]

  <bb 34> [local count: 69678645]: // _63, _60, _61, _62, 312, 247, 252, 257
  goto <bb 40>; [100.00%]
```

Note what is after the // is the phi argument for that edge.
I wonder if this could be done somewhere besides ifcvt.
Basically this is:
if (_48 > _52) t = _56; else t = _60;
if (_49 > _53) t1 = _57; else t1 = _61;

But somehow this converted (jump threading duplicating bbs in some cases) into:
```
if (_48 > _52) {
  t = _56;
  if (_49 > _53) t1 = _57; else t1 = _61;
}  else {
  t = _60;
  if (_49 > _53) t1 = _57; else t1 = _61;
}
```

I suspect this pattern shows up a lot in the jump threaded code.

Reply via email to