Patchwork Enable -fuse-linker-plugin by default when possible, take 2

login
register
mail settings
Submitter Jan Hubicka
Date Jan. 7, 2011, 11:31 p.m.
Message ID <20110107233114.GC3848@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/77934/
State New
Headers show

Comments

Jan Hubicka - Jan. 7, 2011, 11:31 p.m.
Hi,
this is update to testsuite so bulitins tests passes with plugin.
In addition to discussed used attribute needed for memops-asm testcases there are
few extra testcases where we optimize too much.
Previously I commited similar changes to other testcases, but there are couple extra
now when LTO mode uses plugin too.  It is bit surprise to me that these do not
optimize with WHOPR, but I guess I can analyze this later.

I've regtested the following and committed.

Honza

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 168583)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@ 
+2011-01-07  Jan Hubicka  <jh@suse.cz>
+
+	Get builtins tests ready for linker plugin.
+	* gcc.c-torture/execute/builtins/memcpy-chk.c (s2,s3,l1): Mark volatile.
+	* gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memcpy, my_bcopy, my_memset,
+	my_bzero): Mark used.
+	* gcc.c-torture/execute/builtins/memset-chk.c (l1, l3): Mark volatile.
+	* gcc.c-torture/execute/builtins/memmove-chk.c (s1,s2,s3,l1): Mark volatile.
+	* gcc.c-torture/execute/builtins/mempcpy-chk.c (s2,s3,l1): Mark volatile
+
 2011-01-07  Jakub Jelinek  <jakub@redhat.com>
 
 	PR target/47201
Index: gcc.c-torture/execute/builtins/memcpy-chk.c
===================================================================
--- gcc.c-torture/execute/builtins/memcpy-chk.c	(revision 168583)
+++ gcc.c-torture/execute/builtins/memcpy-chk.c	(working copy)
@@ -12,9 +12,9 @@  extern int memcmp (const void *, const v
 
 const char s1[] = "123";
 char p[32] = "";
-char *s2 = "defg";
-char *s3 = "FGH";
-size_t l1 = 1;
+volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made.  */
 
 void
 __attribute__((noinline))
Index: gcc.c-torture/execute/builtins/memops-asm-lib.c
===================================================================
--- gcc.c-torture/execute/builtins/memops-asm-lib.c	(revision 168583)
+++ gcc.c-torture/execute/builtins/memops-asm-lib.c	(working copy)
@@ -4,6 +4,9 @@  typedef __SIZE_TYPE__ size_t;
 
 #define TEST_ABORT if (inside_main) abort()
 
+/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
+   actually refers to this function.  See PR47181. */
+__attribute__ ((used))
 void *
 my_memcpy (void *d, const void *s, size_t n)
 {
@@ -14,6 +17,9 @@  my_memcpy (void *d, const void *s, size_
   return (char *) d;
 }
 
+/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
+   actually refers to this function.  See PR47181. */
+__attribute__ ((used))
 void
 my_bcopy (const void *s, void *d, size_t n)
 {
@@ -31,6 +37,9 @@  my_bcopy (const void *s, void *d, size_t
     }
 }
 
+/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
+   actually refers to this function.  See PR47181. */
+__attribute__ ((used))
 void *
 my_memset (void *d, int c, size_t n)
 {
@@ -40,6 +49,9 @@  my_memset (void *d, int c, size_t n)
   return (char *) d;
 }
 
+/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
+   actually refers to this function.  See PR47181. */
+__attribute__ ((used))
 void
 my_bzero (void *d, size_t n)
 {
Index: gcc.c-torture/execute/builtins/memset-chk.c
===================================================================
--- gcc.c-torture/execute/builtins/memset-chk.c	(revision 168583)
+++ gcc.c-torture/execute/builtins/memset-chk.c	(working copy)
@@ -13,8 +13,8 @@  extern int memcmp (const void *, const v
 
 char buffer[32];
 int argc = 1;
-size_t l1 = 1;
-char *s3 = "FGH";
+volatile size_t l1 = 1;  /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made.  */
 char *s4;
 
 void
Index: gcc.c-torture/execute/builtins/memmove-chk.c
===================================================================
--- gcc.c-torture/execute/builtins/memmove-chk.c	(revision 168583)
+++ gcc.c-torture/execute/builtins/memmove-chk.c	(working copy)
@@ -11,11 +11,11 @@  extern int memcmp (const void *, const v
 
 #include "chk.h"
 
-const char s1[] = "123";
+const char s1[] = "123"; 
 char p[32] = "";
-char *s2 = "defg";
-char *s3 = "FGH";
-size_t l1 = 1;
+volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made.  */
 
 void
 __attribute__((noinline))
Index: gcc.c-torture/execute/builtins/mempcpy-chk.c
===================================================================
--- gcc.c-torture/execute/builtins/mempcpy-chk.c	(revision 168583)
+++ gcc.c-torture/execute/builtins/mempcpy-chk.c	(working copy)
@@ -13,9 +13,9 @@  extern int memcmp (const void *, const v
 
 const char s1[] = "123";
 char p[32] = "";
-char *s2 = "defg";
-char *s3 = "FGH";
-size_t l1 = 1;
+volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made.  */
+volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made.  */
 
 void
 __attribute__((noinline))