[Bug middle-end/52861] (missed optimisation) missed transformation to memset with -O3

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 4 16:35:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52861

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
                 CC|                            |burnus at gcc dot gnu.org
          Component|fortran                     |middle-end

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-04 16:35:18 UTC ---
Regarding the first test cases:

For qq1.f, the loop remains and one gets in the loop:
    MEM[base: isu_34(D), index: ivtmp.19_49, step: 4, offset: 0B] = 0;
    __builtin_memcpy (D.1901_38, &"        "[0], 8);
    MEM[base: rsv_45(D), index: ivtmp.19_49, step: 4, offset: 0B] = 0.0;


For qq2, the first loop is replaced by:
    __builtin_memset (isu_35(D), 0, D.1935_54);
    __builtin_memset (rsv_38(D), 0, D.1935_54);
while for the character string, the loop is kept.



For the rather common (Fortran) case of assigning blanks (" ") to a string (cf.
also the third test case), it would be good to replace the loop
    __builtin_memcpy (D.1909_46, &"        "[0], 8);
by (outside the loop)
    __builtin_memset (D.1909_46, " ", <array-size>*<string-length>);



More information about the Gcc-bugs mailing list