[Bug tree-optimization/30398] memmove for string operations
tobi at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Apr 13 15:27:00 GMT 2007
------- Comment #3 from tobi at gcc dot gnu dot org 2007-04-13 16:27 -------
With FX' patch to inline REPEAT (see PR31304), we are left with this as final
dump after a -O compilation:
;; Function MAIN__ (MAIN__)
MAIN__ ()
{
char[1:] * pstr.1;
char s[1:1];
char c[1:2];
void * D.1004;
<bb 2>:
_gfortran_set_std (68, 127, 0, 0, 0);
s[1]{lb: 1 sz: 1} = 97;
D.1004 = _gfortran_internal_malloc (2);
pstr.1 = (char[1:] *) D.1004;
__builtin_memcpy ((char *) pstr.1, &s, 1);
__builtin_memcpy (pstr.1 + 1B, &s, 1);
__builtin_memmove (&c, pstr.1, 2);
_gfortran_internal_free (pstr.1);
return;
}
The call to memmove makes it way into the assembly, even though pstr and c
can't alias. This is now an optimizer issue, moving to component
tree-optimization, as the tree-ssa optimizers should be able to eliminate the
memmove in favor of a memcpy. Or even better, get rid of the whole copying
business and predict the correct results. If that's possible it would be great
to have a way to get rid of the then unnecessary temporary allocation.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org,
| |fxcoudert at gcc dot gnu dot
| |org
Component|fortran |tree-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30398
More information about the Gcc-bugs
mailing list