This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/64045] fortran.dg/pr45636.f90 fails for AArch64 - memcpy and memset are not combined


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

--- Comment #1 from kugan at gcc dot gnu.org ---
Look at gcc/tree-ssa-fwprop.c:1650

      /* If the new memcpy wouldn't be emitted by storing the literal
         by pieces, this optimization might enlarge .rodata too much,
         as commonly used string literals couldn't be shared any
         longer.  */
      if (!can_store_by_pieces (src_len,
                    builtin_strncpy_read_str,
                    src_buf, ptr1_align, false))
        break;

AArch64 back-end rejects use_by_pieces_infrastructure for STORE_BY_PIECES and
hence this optimisation will fail. It is probably an xfail case if back-end is
going to reject it.


static bool
aarch64_use_by_pieces_infrastructure_p (unsigned int size,
                                       unsigned int align,
                                       enum by_pieces_operation op,
                                       bool speed_p)
{
  /* STORE_BY_PIECES can be used when copying a constant string, but
     in that case each 64-bit chunk takes 5 insns instead of 2 (LDR/STR).
     For now we always fail this and let the move_by_pieces code copy
     the string from read-only memory.  */
  if (op == STORE_BY_PIECES)
    return false;

  return default_use_by_pieces_infrastructure_p (size, align, op, speed_p);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]