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

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> This might be the path splitting running on the gimple level causing issues
> too; see PR 112402 .

Actually I was wrong. In this case it is jump threading which messes up the
CFG.

at `-O3 -fno-thread-jumps` on the trunk on aarch64 we get:
        cmp     w0, 0
        csinc   x21, x21, x19, le
        csel    x20, x20, x19, ge

Which is exactly what we want.

The jump threaded IR looks like:
```
  if (_17 > 0)
    goto <bb 4>; [59.00%]
  else
    goto <bb 5>; [41.00%]

  <bb 4> [local count: 598664758]:
  low_19 = i_14 + 1;
  goto <bb 6>; [100.00%]

  <bb 5> [local count: 416021267]:
  if (_17 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 8>; [50.00%]

  <bb 6> [local count: 958878294]:
  # low_18 = PHI <low_24(5), low_19(4)>
  # high_6 = PHI <i_14(5), high_25(4)>
```
Which rtl level ifcvt does not recongize at all as something for cmov.

Reply via email to