2010-01-13 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jan 2010 10:07:47 +0000 (10:07 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jan 2010 10:07:47 +0000 (10:07 +0000)
PR lto/42678
* tree-pass.h (PROP_gimple_lcx): New.
* cfgexpand.c (pass_expand): Require PROP_gimple_lcx.
* passes.c (init_optimization_passes): Move pass_lower_complex_O0
before the final cleanup_eh.
(dump_properties): Dump PROP_gimple_lcx.
* tree-complex.c (pass_lower_complex): Provide PROP_gimple_lcx.
(tree_lower_complex_O0): Remove.
(gate_no_optimization): Run if PROP_gimple_lcx is not set.
(pass_lower_complex_O0): Provide PROP_gimple_lcx.  Run
tree_lower_complex, schedule TODO_update_ssa.
* lto-streamer-out.c (output_function): Stream the functions
properties.
* lto-streamer-in.c (input_function): Likewise.
(lto_read_body): Do not override them here.

* gfortran.dg/lto/20100110-1_0.f90: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155853 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgexpand.c
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 [new file with mode: 0644]
gcc/tree-complex.c
gcc/tree-pass.h

index 315ebee..985ec60 100644 (file)
@@ -1,3 +1,21 @@
+2010-01-13  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/42678
+       * tree-pass.h (PROP_gimple_lcx): New.
+       * cfgexpand.c (pass_expand): Require PROP_gimple_lcx.
+       * passes.c (init_optimization_passes): Move pass_lower_complex_O0
+       before the final cleanup_eh.
+       (dump_properties): Dump PROP_gimple_lcx.
+       * tree-complex.c (pass_lower_complex): Provide PROP_gimple_lcx.
+       (tree_lower_complex_O0): Remove.
+       (gate_no_optimization): Run if PROP_gimple_lcx is not set.
+       (pass_lower_complex_O0): Provide PROP_gimple_lcx.  Run
+       tree_lower_complex, schedule TODO_update_ssa.
+       * lto-streamer-out.c (output_function): Stream the functions
+       properties.
+       * lto-streamer-in.c (input_function): Likewise.
+       (lto_read_body): Do not override them here.
+
 2010-01-12  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/42708
index 7e542da..70d2b35 100644 (file)
@@ -3743,7 +3743,8 @@ struct rtl_opt_pass pass_expand =
   NULL,                                 /* next */
   0,                                    /* static_pass_number */
   TV_EXPAND,                           /* tv_id */
-  PROP_ssa | PROP_gimple_leh | PROP_cfg,/* properties_required */
+  PROP_ssa | PROP_gimple_leh | PROP_cfg
+    | PROP_gimple_lcx,                 /* properties_required */
   PROP_rtl,                             /* properties_provided */
   PROP_ssa | PROP_trees,               /* properties_destroyed */
   TODO_verify_ssa | TODO_verify_flow
index c390f27..f316459 100644 (file)
@@ -1291,6 +1291,9 @@ input_function (tree fn_decl, struct data_in *data_in,
   fn->va_list_gpr_size = bp_unpack_value (bp, 8);
   bitpack_delete (bp);
 
+  /* Input the current IL state of the function.  */
+  fn->curr_properties = lto_input_uleb128 (ib);
+
   /* Read the static chain and non-local goto save area.  */
   fn->static_chain_decl = lto_input_tree (ib, data_in);
   fn->nonlocal_goto_save_area = lto_input_tree (ib, data_in);
@@ -1466,14 +1469,6 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
       /* We should now be in SSA.  */
       cfun->gimple_df->in_ssa_p = true;
 
-      /* Fill in properties we know hold for the rebuilt CFG.  */
-      cfun->curr_properties = PROP_ssa
-                             | PROP_cfg
-                             | PROP_gimple_any
-                             | PROP_gimple_lcf
-                             | PROP_gimple_leh
-                             | PROP_referenced_vars;
-
       /* Restore decl state */
       file_data->current_decl_state = file_data->global_decl_state;
 
index fe43dce..d5431ba 100644 (file)
@@ -1872,6 +1872,9 @@ output_function (struct cgraph_node *node)
   lto_output_bitpack (ob->main_stream, bp);
   bitpack_delete (bp);
 
+  /* Output current IL state of the function.  */
+  output_uleb128 (ob, fn->curr_properties);
+
   /* Output the static chain and non-local goto save area.  */
   lto_output_tree_ref (ob, fn->static_chain_decl);
   lto_output_tree_ref (ob, fn->nonlocal_goto_save_area);
index fde3379..a04a5ef 100644 (file)
@@ -728,7 +728,6 @@ init_optimization_passes (void)
   NEXT_PASS (pass_refactor_eh);
   NEXT_PASS (pass_lower_eh);
   NEXT_PASS (pass_build_cfg);
-  NEXT_PASS (pass_lower_complex_O0);
   NEXT_PASS (pass_lower_vector);
   NEXT_PASS (pass_warn_function_return);
   NEXT_PASS (pass_build_cgraph_edges);
@@ -943,6 +942,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_uncprop);
       NEXT_PASS (pass_local_pure_const);
     }
+  NEXT_PASS (pass_lower_complex_O0);
   NEXT_PASS (pass_cleanup_eh);
   NEXT_PASS (pass_lower_resx);
   NEXT_PASS (pass_nrv);
@@ -1883,6 +1883,8 @@ dump_properties (FILE *dump, unsigned int props)
     fprintf (dump, "PROP_rtl\n");
   if (props & PROP_gimple_lomp)
     fprintf (dump, "PROP_gimple_lomp\n");
+  if (props & PROP_gimple_lcx)
+    fprintf (dump, "PROP_gimple_lcx\n");
 }
 
 void
index ae31eae..f8532af 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-13  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/42678
+       * gfortran.dg/lto/20100110-1_0.f90: New testcase.
+
 2010-01-12  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/42708
diff --git a/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 b/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90
new file mode 100644 (file)
index 0000000..d3caa61
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-lto-do link }
+! { dg-lto-options {{ -O1 -flto }} }
+! { dg-suppress-ld-options "-O1" }
+
+      SUBROUTINE ylm4(ylm)
+      COMPLEX, INTENT (OUT):: ylm(1)
+      INTEGER l,m
+      COMPLEX ylms
+      REAL, ALLOCATABLE, SAVE  :: ynorm(:)
+      ylms = 0
+      DO m = 1, 1
+         DO l = m, 1
+            ylm(m) = conjg(ylms)*ynorm(m)
+         ENDDO
+      ENDDO
+      END SUBROUTINE ylm4
+
+      PROGRAM test
+      END
index 53bf118..ea0a651 100644 (file)
@@ -1622,7 +1622,7 @@ struct gimple_opt_pass pass_lower_complex =
   0,                                   /* static_pass_number */
   TV_NONE,                             /* tv_id */
   PROP_ssa,                            /* properties_required */
-  0,                                   /* properties_provided */
+  PROP_gimple_lcx,                     /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
   TODO_dump_func
@@ -1633,32 +1633,12 @@ struct gimple_opt_pass pass_lower_complex =
 };
 
 \f
-/* Entry point for complex operation lowering without optimization.  */
-
-static unsigned int
-tree_lower_complex_O0 (void)
-{
-  int old_last_basic_block = last_basic_block;
-  gimple_stmt_iterator gsi;
-  basic_block bb;
-
-  FOR_EACH_BB (bb)
-    {
-      if (bb->index >= old_last_basic_block)
-       continue;
-
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-       expand_complex_operations_1 (&gsi);
-    }
-  return 0;
-}
-
 static bool
 gate_no_optimization (void)
 {
   /* With errors, normal optimization passes are not run.  If we don't
      lower complex operations at all, rtl expansion will abort.  */
-  return optimize == 0 || sorrycount || errorcount;
+  return !(cfun->curr_properties & PROP_gimple_lcx);
 }
 
 struct gimple_opt_pass pass_lower_complex_O0 =
@@ -1667,16 +1647,18 @@ struct gimple_opt_pass pass_lower_complex_O0 =
   GIMPLE_PASS,
   "cplxlower0",                                /* name */
   gate_no_optimization,                        /* gate */
-  tree_lower_complex_O0,               /* execute */
+  tree_lower_complex,                  /* execute */
   NULL,                                        /* sub */
   NULL,                                        /* next */
   0,                                   /* static_pass_number */
   TV_NONE,                             /* tv_id */
   PROP_cfg,                            /* properties_required */
-  0,                                   /* properties_provided */
+  PROP_gimple_lcx,                     /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_dump_func | TODO_ggc_collect
-    | TODO_verify_stmts,               /* todo_flags_finish */
+  TODO_dump_func
+    | TODO_ggc_collect
+    | TODO_update_ssa
+    | TODO_verify_stmts                        /* todo_flags_finish */
  }
 };
index 40cfb0f..383a164 100644 (file)
@@ -226,6 +226,7 @@ struct dump_file_info
 #define PROP_rtl               (1 << 7)
 #define PROP_gimple_lomp       (1 << 8)        /* lowered OpenMP directives */
 #define PROP_cfglayout         (1 << 9)        /* cfglayout mode on RTL */
+#define PROP_gimple_lcx                (1 << 10)       /* lowered complex */
 
 #define PROP_trees \
   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)