This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/66648] [4.9/5/6 regression] incorrect memcpy expansion with unrolled_loop strategy at -O2
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Jun 2015 11:29:20 +0000
- Subject: [Bug target/66648] [4.9/5/6 regression] incorrect memcpy expansion with unrolled_loop strategy at -O2
- Auto-submitted: auto-generated
- References: <bug-66648-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66648
--- Comment #3 from UroÅ Bizjak <ubizjak at gmail dot com> ---
Untested patch:
--cut here--
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 224993)
+++ config/i386/i386.c (working copy)
@@ -25008,7 +25008,8 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx c
dst = change_address (dst, BLKmode, destreg);
set_mem_align (dst, desired_align * BITS_PER_UNIT);
epilogue_size_needed = 0;
- if (need_zero_guard && !min_size)
+ if (need_zero_guard
+ && min_size < (unsigned HOST_WIDE_INT) size_needed)
{
/* It is possible that we copied enough so the main loop will not
execute. */
@@ -25140,7 +25141,7 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx c
max_size -= align_bytes;
}
if (need_zero_guard
- && !min_size
+ && min_size < (unsigned HOST_WIDE_INT) size_needed
&& (count < (unsigned HOST_WIDE_INT) size_needed
|| (align_bytes == 0
&& count < ((unsigned HOST_WIDE_INT) size_needed
--cut here--
We have to emit check for main loop execution UNLESS we guarantee that min_size
is at least equal to size_needed. In this testcase, VRP declared minimum
copying size, and after unaligned prologue adjustment, min_size was still
non-zero. The !min_size check didn't account for the case that min_size can be
non-zero, but still less than size_needed.