This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add value range support into memcpy/memset expansion
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Richard Biener <rguenther at suse dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>, steven at gcc dot gnu dot org
- Date: Tue, 19 Nov 2013 02:23:39 +0100
- Subject: Re: Add value range support into memcpy/memset expansion
- Authentication-results: sourceware.org; auth=none
- References: <20130927145046 dot GC6666 at kam dot mff dot cuni dot cz> <20131115094517 dot GA18020 at atrey dot karlin dot mff dot cuni dot cz> <alpine dot LNX dot 2 dot 00 dot 1311151119170 dot 4261 at zhemvz dot fhfr dot qr> <20131117233820 dot GE2268 at kam dot mff dot cuni dot cz> <CAMe9rOqiGi6n_0EJgdQfu6b5toMVPcVS08vt+AmrVi52cMVOkA at mail dot gmail dot com> <CAMe9rOoXW=ctXmS0E-8vUnZwZMYDA5K3qeyFLTTk4r9k5BuLHQ at mail dot gmail dot com> <CAMe9rOrhd+rLxZeYZwj0vtUnVPJoUKcJVDL8NLGr=AEjqtL_Cw at mail dot gmail dot com> <20131118174547 dot GG11338 at kam dot mff dot cuni dot cz>
Hi,
this patch fixes two issues with memcpy testcase - silences warning and updates
the template as suggested by Uros in the PR. The testcase still fails on i386.
This is because we end up with:
;; Function t (t, funcdef_no=0, decl_uid=1763, symbol_order=2)
t (unsigned int c)
{
void * b.0_4;
void * a.1_5;
<bb 2>:
if (c_2(D) <= 9)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
b.0_4 = b;
a.1_5 = a;
memcpy (a.1_5, b.0_4, c_2(D));
<bb 4>:
return;
}
and we have no useful value range on c_2 because assert_expr was removed,
while in 64bit version there is a cast in bb 3 that preserves the info.
Solving this is an independent (and I guess not terribly easy) problem.
Regtested x86_64-linux, will commit it shortly.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 204984)
+++ ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2013-11-18 Jan Hubicka <jh@suse.cz>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ PR middle-end/59175
+ * gcc.target/i386/memcpy-2.c: Fix template;
+ add +1 so the testcase passes at 32bit.
+
2013-11-18 Dominique d'Humieres <dominiq@lps.ens.fr>
* c-c++-common/cilk-plus/PS/reduction-3.c: Use stdlib.h.
Index: gcc.target/i386/memcpy-2.c
===================================================================
--- gcc.target/i386/memcpy-2.c (revision 204984)
+++ gcc.target/i386/memcpy-2.c (working copy)
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
-/* Memcpy should be inlined because block size is known. */
-/* { dg-final { scan-assembler-not "memcpy" } } */
void *a;
void *b;
t(unsigned int c)
{
if (c<10)
- memcpy (a,b,c);
+ __builtin_memcpy (a,b,c+1);
}
+/* Memcpy should be inlined because block size is known. */
+/* { dg-final { scan-assembler-not "(jmp|call)\[\\t \]*memcpy" } } */