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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2022-07-12
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think ICC elides the outer loop, it does keep the inner loop where GCC
unrolls the inner loop, keeping the outer loop.  There's no "benchmark loop"
elimination in GCC yet, instead we rely on code sinking which, at the moment,
cannot sink the memset calls out of the outer loop.

#include <string.h>
void foo (int *mem, int n)
{
  for (int i = 0; i < 1000; ++i)
    memset (mem, 0, n * sizeof (int));
}

ICC probably manages to elide the loop around the memset here.

Reply via email to