This is the mail archive of the gcc-patches@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]

Re: Add value range support into memcpy/memset expansion


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" } } */


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