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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-02-06
     Ever confirmed|0                           |1

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Well, with -O2 it's dead-code elimination pass that removes the GCOV counter
stores:

void * idle (void * ignored)
{
  long int __gcov0.idle_I_lsm.4;
  long int PROF_edge_counter_2;

  <bb 2> [local count: 10631108]:
  __gcov0.idle_I_lsm.4_7 = __gcov0.idle[0];

  <bb 3> [local count: 1073741824]:
  # __gcov0.idle_I_lsm.4_6 = PHI <__gcov0.idle_I_lsm.4_7(2),
PROF_edge_counter_2(4)>
  PROF_edge_counter_2 = __gcov0.idle_I_lsm.4_6 + 1;

  <bb 4> [local count: 1073741824]:
  goto <bb 3>; [100.00%]

}

after:

Eliminating unnecessary statements:
Deleting : PROF_edge_counter_2 = __gcov0.idle_I_lsm.4_6 + 1;

Deleting : __gcov0.idle_I_lsm.4_6 = PHI <__gcov0.idle_I_lsm.4_7(2), _2(4)>

Deleting : __gcov0.idle_I_lsm.4_7 = __gcov0.idle[0];

Removed 2 of 2 statements (100%)
Removed 1 of 2 PHI nodes (50%)
Merging blocks 3 and 4
fix_loop_structure: fixing up loops for function
void * idle (void * ignored)
{
  long int __gcov0.idle_I_lsm.4;

  <bb 2> [local count: 10631108]:

  <bb 3> [local count: 1073741824]:
  goto <bb 3>; [100.00%]

}

@Richi: is it expected behavior?

Reply via email to