[Bug fortran/38592] eliminate some string comparisons
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 7 19:39:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38592
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #6 from kargl at gcc dot gnu.org ---
Sometime between 4.8.4 and 4.9.4, the _gfortran_compare_string
has been replaced by a memcmp().
% gfc48 -O3 -fdump-tree-optimized -S -fdump-tree-original a.f90
% grep compare a.s
call _gfortran_compare_string
% gfc49 -O3 -fdump-tree-optimized -S -fdump-tree-original a.f90
% grep compare a.s
With gcc7, the -fdump-tree-original gives
__builtin_memmove ((void *) &a, (void *) &"yes"[1]{lb: 1 sz: 1}, 3);
{
struct __st_parameter_dt dt_parm.0;
dt_parm.0.common.filename = &"a.f90"[1]{lb: 1 sz: 1};
dt_parm.0.common.line = 4;
dt_parm.0.common.flags = 128;
dt_parm.0.common.unit = 6;
_gfortran_st_write (&dt_parm.0);
{
logical(kind=4) D.3408;
D.3408 = __builtin_memcmp ((void *) &"yes"[1]{lb: 1 sz: 1},
(void *) &a, 3) == 0;
_gfortran_transfer_logical_write (&dt_parm.0, &D.3408, 4);
}
_gfortran_st_write_done (&dt_parm.0);
and -fdump-tree-optimized shows
<bb 2>:
MEM[(c_char * {ref-all})&a] = "yes";
dt_parm.0.common.filename = &"a.f90"[1]{lb: 1 sz: 1};
dt_parm.0.common.line = 4;
dt_parm.0.common.flags = 128;
dt_parm.0.common.unit = 6;
_gfortran_st_write (&dt_parm.0);
_1 = __builtin_memcmp_eq (&"yes"[1]{lb: 1 sz: 1}, &a, 3);
_2 = _1 == 0;
D.3408 = _2;
_gfortran_transfer_logical_write (&dt_parm.0, &D.3408, 4);
D.3408 ={v} {CLOBBER};
_gfortran_st_write_done (&dt_parm.0);
dt_parm.0 ={v} {CLOBBER};
a ={v} {CLOBBER};
return;
I personally think this is non-issue now and the bug can be
closed.
More information about the Gcc-bugs
mailing list