This patch updates ssa and inline summary in the correct location for AutoFDO.

Bootstrapped and passed regression test. OK for trunk?

Thanks,
Dehao

gcc/ChangeLog:
2014-11-18  Dehao Chen  <de...@google.com>

        * auto-profile.c (afdo_annotate_cfg): Invoke update_ssa in the right
        place.
        (auto_profile): Recompute inline summary after processing cgraph node.

Index: gcc/auto-profile.c
===================================================================
--- gcc/auto-profile.c (revision 217741)
+++ gcc/auto-profile.c (working copy)
@@ -1514,7 +1514,14 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
       profile_status_for_fn (cfun) = PROFILE_READ;
     }
   if (flag_value_profile_transformations)
-    gimple_value_profile_transformations ();
+    {
+      gimple_value_profile_transformations ();
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_DOMINATORS);
+      update_ssa (TODO_update_ssa);
+    }
 }

 /* Wrapper function to invoke early inliner.  */
@@ -1592,7 +1599,6 @@ auto_profile (void)
     early_inline ();
     autofdo::afdo_annotate_cfg (promoted_stmts);
     compute_function_frequency ();
-    update_ssa (TODO_update_ssa);

     /* Local pure-const may imply need to fixup the cfg.  */
     if (execute_fixup_cfg () & TODO_cleanup_cfg)
@@ -1601,6 +1607,7 @@ auto_profile (void)
     free_dominance_info (CDI_DOMINATORS);
     free_dominance_info (CDI_POST_DOMINATORS);
     cgraph_edge::rebuild_edges ();
+    compute_inline_parameters (cgraph_node::get (current_function_decl), true);
     pop_cfun ();
   }

Reply via email to