[Bug tree-optimization/127180] New: missed PHI eliding

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 1 14:04:41 GMT 2026


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

            Bug ID: 127180
           Summary: missed PHI eliding
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

gcc.dg/gomp/static-chunk-size-one.c shows

  <bb 2> [local count: 118111600]:
  _3 = __builtin_GOMP_loop_static_worksharing (10);
  _4 = IMAGPART_EXPR <_3>;
  if (_4 <= 9)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]

  <bb 3> [local count: 105119324]:
  _5 = REALPART_EXPR <_3>;
  _15 = (unsigned int) _5;
  _17 = (unsigned int) _4;
  ivtmp.12_16 = _15 + _17;

  <bb 4> [local count: 955630224]:
  # a_19 = PHI <a_13(4), 0(3)>
  # _22 = PHI <_7(4), _4(3)>
  # ivtmp.12_2 = PHI <ivtmp.12_1(4), ivtmp.12_16(3)>
  a_13 = a_19 + _22;
  _7 = (int) ivtmp.12_2;
  ivtmp.12_1 = ivtmp.12_2 + _15;
  if (_7 <= 9)
    goto <bb 4>; [89.00%]
  else
    goto <bb 5>; [11.00%]

  <bb 5> [local count: 118111600]:
  # a_20 = PHI <a_13(4), 0(2)>
  _9 = &.omp_data_i_8(D)->a;
  a.2_10 = (unsigned int) a_20;
  __atomic_fetch_add_4 (_9, a.2_10, 0); [tail call]
  return;

where _22 used to be elided as peeled chrec, but we can't do this.  There
might be other ways though.


More information about the Gcc-bugs mailing list