]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR lto/50165 (Huge build time regression (Firefox lto build))
authorMichael Matz <matz@suse.de>
Fri, 26 Aug 2011 16:02:17 +0000 (16:02 +0000)
committerMichael Matz <matz@gcc.gnu.org>
Fri, 26 Aug 2011 16:02:17 +0000 (16:02 +0000)
PR lto/50165
* lto-streamer-in.c (canon_file_name): Initialize new_slot->len;
don't call strlen twice, use memcpy.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r178118

gcc/ChangeLog
gcc/lto-streamer-in.c

index 3cbab3ebddeffafa7ad0ab7acae32a3a7050f435..1ec7edc0d9902e6a7b580ef606f8f1b720a2b112 100644 (file)
@@ -1,3 +1,10 @@
+2011-08-26  Michael Matz  <matz@suse.de>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/50165
+       * lto-streamer-in.c (canon_file_name): Initialize new_slot->len;
+       don't call strlen twice, use memcpy.
+
 2011-08-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/bmi2intrin.h: Allow in <immintrin.h>.
index 331eba8bd30c81db926c9d375a6324a248bc5efa..bae21d5bc4a5518e2dad0b0735019c90399a3cb8 100644 (file)
@@ -98,21 +98,22 @@ canon_file_name (const char *string)
 {
   void **slot;
   struct string_slot s_slot;
+  size_t len = strlen (string);
+
   s_slot.s = string;
-  s_slot.len = strlen (string);
+  s_slot.len = len;
 
   slot = htab_find_slot (file_name_hash_table, &s_slot, INSERT);
   if (*slot == NULL)
     {
-      size_t len;
       char *saved_string;
       struct string_slot *new_slot;
 
-      len = strlen (string);
       saved_string = (char *) xmalloc (len + 1);
       new_slot = XCNEW (struct string_slot);
-      strcpy (saved_string, string);
+      memcpy (saved_string, string, len + 1);
       new_slot->s = saved_string;
+      new_slot->len = len;
       *slot = new_slot;
       return saved_string;
     }