cgraphunit.c (cgraph_varpool_analyze_pending_decls): Call align_variable.
authorJan Hubicka <jh@suse.cz>
Thu, 13 Jul 2006 20:49:34 +0000 (22:49 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 13 Jul 2006 20:49:34 +0000 (20:49 +0000)
* cgraphunit.c (cgraph_varpool_analyze_pending_decls): Call align_variable.
* output.h (align_variable): Declare.
* varasm.c (align_variable): Export.
* value-prof.c (tree_value_profile_transformations): Recompute iterator
when basic block changed.

From-SVN: r115421

gcc/ChangeLog
gcc/cgraphunit.c
gcc/output.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/memcpy-1.c [new file with mode: 0644]
gcc/value-prof.c
gcc/varasm.c

index dd490fa8a054e6b6c43781a4a14ae115aadfabce..72167faf510a5969508fca29876171a285f096b6 100644 (file)
@@ -1,3 +1,12 @@
+2006-07-13  Jan Hubicka  <jh@suse.cz>
+
+       * cgraphunit.c (cgraph_varpool_analyze_pending_decls): Call
+       align_variable.
+       * output.h (align_variable): Declare.
+       * varasm.c (align_variable): Export.
+       * value-prof.c (tree_value_profile_transformations): Recompute iterator
+       when basic block changed.
+
 2006-07-13  Nick Clifton  <nickc@redhat.com>
 
        * config/sh/sh.c (sh_reorg): Ignore deleted insns whilst
index 33028b2f331a693ccc97eb14a610282976b1e317..d02ead5fcff1167908979e85d037e5aac02483e4 100644 (file)
@@ -281,6 +281,10 @@ cgraph_varpool_analyze_pending_decls (void)
 
       cgraph_varpool_first_unanalyzed_node = cgraph_varpool_first_unanalyzed_node->next_needed;
 
+      /* Compute the alignment early so function body expanders are
+        already informed about increased alignment.  */
+      align_variable (decl, 0);
+
       if (DECL_INITIAL (decl))
        {
          visited_nodes = pointer_set_create ();
index 69f8378a0bcd3d6e206b9467af4d063e6448680f..6d518c45803e3643aa65ef4b3be839e7b9635afa 100644 (file)
@@ -200,6 +200,10 @@ extern void assemble_end_function (tree, const char *);
    initial value (that will be done by the caller).  */
 extern void assemble_variable (tree, int, int, int);
 
+/* Compute the alignment of variable specified by DECL.
+   DONT_OUTPUT_DATA is from assemble_variable.  */
+extern void align_variable (tree decl, bool dont_output_data);
+
 /* Output something to declare an external symbol to the assembler.
    (Most assemblers don't need this, so we normally output nothing.)
    Do nothing if DECL is not external.  */
index 15484111c2d1751de172c19d71563ad9fa8e1a26..b133204f32cde9d9bca777210785ad989408fb0f 100644 (file)
@@ -1,3 +1,7 @@
+2006-07-13  Jan Hubicka  <jh@suse.cz>
+
+       * gcc.target/i386/memcpy-1.c: New.
+
 2006-07-12  Geoffrey Keating  <geoffk@apple.com>
 
        * g++.dg/ext/visibility/fvisibility-inlines-hidden-2.C: New.
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-1.c b/gcc/testsuite/gcc.target/i386/memcpy-1.c
new file mode 100644 (file)
index 0000000..edd0c7b
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro -minline-all-stringops" } */
+/* { dg-final { scan-assembler "rep" } } */
+/* { dg-final { scan-assembler "movs" } } */
+/* { dg-final { scan-assembler-not "test" } } */
+/* { dg-final { scan-assembler "\.L?:" } } */
+
+/* A and B are aligned, but we used to lose track of it.
+   Ensure that memcpy is inlined and alignment prologue is missing.  */
+
+char a[900];
+char b[900];
+t()
+{
+  __builtin_memcpy (a,b,900);
+}
index 59b0f351530bf444c5952c5e97f42c51eda2b9b5..e273a40f9c903b507c2f18a779bab54ab752e795 100644 (file)
@@ -147,7 +147,11 @@ tree_value_profile_transformations (void)
            {
              changed = true;
              /* Original statement may no longer be in the same block. */
-             bb = bb_for_stmt (stmt);
+             if (bb != bb_for_stmt (stmt))
+               {
+                 bb = bb_for_stmt (stmt);
+                 bsi = bsi_for_stmt (stmt);
+               }
            }
 
          /* Free extra storage from compute_value_histograms.  */
index a10d954d0c6e6c9df6e9bc451724095019c07919..9dcc3b442cf4a9489853de9c1811dea0ab8d426f 100644 (file)
@@ -834,7 +834,7 @@ bss_initializer_p (tree decl)
 /* Compute the alignment of variable specified by DECL.
    DONT_OUTPUT_DATA is from assemble_variable.  */
 
-static void
+void
 align_variable (tree decl, bool dont_output_data)
 {
   unsigned int align = DECL_ALIGN (decl);