[Bug ipa/60911] [4.9/4.10 Regression] wrong code with -O2 -flto -fipa-pta

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 24 09:47:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60911

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Index: gcc/passes.c
===================================================================
--- gcc/passes.c        (revision 209742)
+++ gcc/passes.c        (working copy)
@@ -2194,8 +2194,26 @@ execute_one_pass (opt_pass *pass)
      Apply all trnasforms first.  */
   if (pass->type == SIMPLE_IPA_PASS)
     {
+      struct cgraph_node *node;
       bool applied = false;
-      do_per_function (apply_ipa_transforms, (void *)&applied);
+      FOR_EACH_DEFINED_FUNCTION (node)
+       if (node->analyzed
+           && cgraph_function_with_gimple_body_p (node)
+           && (!node->clone_of || node->decl != node->clone_of->decl))
+         {
+           if (!node->global.inlined_to
+               && node->ipa_transforms_to_apply.exists ())
+             {
+               cgraph_get_body (node);
+               push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+               execute_all_ipa_transforms ();
+               rebuild_cgraph_edges ();
+               free_dominance_info (CDI_DOMINATORS);
+               free_dominance_info (CDI_POST_DOMINATORS);
+               pop_cfun ();
+               applied = true;
+             }
+         }
       if (applied)
         symtab_remove_unreachable_nodes (true, dump_file);
       /* Restore current_pass.  */

should work and avoid all the issues I ran into with the patches patching
do_per_function.

I'm testing that for trunk/4.9 now with possible cleanups done on trunk
only.



More information about the Gcc-bugs mailing list