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

--- Comment #3 from Florian La Roche <florian.laroche at googlemail dot com> ---
Hello Martin,

I assume the two functions clear_bss1() and clear_bss2() to work on
identical aligned data and produce similar assembler output.
Yet looking at the assembler output, the first function produces
many more assembler lines. "-Os" keeps the assembler lines also pretty small.

The first assembler listing should remove "18" to "2C" the last
listing should remove "13" to "22".



Here another output from gcc, where the additional pseudocode shows up
after optimizations. The lines with pseudo vars "_13" to "_20" should
not be produced at all.



;; Function clear_bss1 (clear_bss1, funcdef_no=0, decl_uid=3118, cgraph_uid=0,
symbol_order=0)

Removing basic block 6
Removing basic block 7
Removing basic block 8
clear_bss1 ()
{
  unsigned long ivtmp.9;
  void * _11;
  unsigned long _12;
  unsigned long _13;
  unsigned long _16;
  unsigned long _17;
  unsigned long _18;
  unsigned long _19;
  unsigned long _20;

  <bb 2> [15.00%]:
  if (&__bss_start1 < &__bss_end1)
    goto <bb 3>; [85.00%]
  else
    goto <bb 5>; [15.00%]

  <bb 3> [12.75%]:
  ivtmp.9_7 = (unsigned long) &MEM[(void *)&__bss_start1 + 8B];
  _12 = (unsigned long) &__bss_end1;
  _13 = _12 + 7;
  _16 = _13 - ivtmp.9_7;
  _17 = _16 & 18446744073709551608;
  _18 = (unsigned long) &__bss_start1;
  _19 = _18 + 16;
  _20 = _17 + _19;

  <bb 4> [85.00%]:
  # ivtmp.9_10 = PHI <ivtmp.9_1(4), ivtmp.9_7(3)>
  _11 = (void *) ivtmp.9_10;
  MEM[base: _11, offset: -8B] = 0;
  ivtmp.9_1 = ivtmp.9_10 + 8;
  if (ivtmp.9_1 != _20)
    goto <bb 4>; [85.00%]
  else
    goto <bb 5>; [15.00%]

  <bb 5> [15.00%]:
  return;

}


;; Function clear_bss2 (clear_bss2, funcdef_no=1, decl_uid=3127, cgraph_uid=1,
symbol_order=1)

Removing basic block 5
Removing basic block 6
Removing basic block 7
Removing basic block 8
clear_bss2 ()
{
  long unsigned int * bss;
  long unsigned int * __bss_end2.2_10;

  <bb 2> [15.00%]:
  bss_5 = __bss_start2;
  __bss_end2.2_10 = __bss_end2;
  if (bss_5 < __bss_end2.2_10)
    goto <bb 3>; [85.00%]
  else
    goto <bb 4>; [15.00%]

  <bb 3> [85.00%]:
  # bss_11 = PHI <bss_6(3), bss_5(2)>
  bss_6 = bss_11 + 8;
  MEM[base: bss_6, offset: -8B] = 0;
  if (bss_6 < __bss_end2.2_10)
    goto <bb 3>; [85.00%]
  else
    goto <bb 4>; [15.00%]

  <bb 4> [15.00%]:
  return;

}





Is this helping to explain my bug entry?


best regards,

Florian La Roche

Reply via email to