diff options
author | Richard Biener <rguenther@suse.de> | 2014-04-25 07:44:40 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-04-25 07:44:40 +0000 |
commit | 78422fb13c3f57b962d4c6cff7a9493ea3b12c14 (patch) | |
tree | 8704edaf42da9ff264a1161053e6f508bbca568f /gcc/passes.c | |
parent | 9490b8da72088fe6f1b23c323749d977e3aa02f1 (diff) | |
download | gcc-78422fb13c3f57b962d4c6cff7a9493ea3b12c14.zip gcc-78422fb13c3f57b962d4c6cff7a9493ea3b12c14.tar.gz gcc-78422fb13c3f57b962d4c6cff7a9493ea3b12c14.tar.bz2 |
re PR ipa/60911 (wrong code with -O2 -flto -fipa-pta)
2014-04-25 Richard Biener <rguenther@suse.de>
PR ipa/60911
* passes.c (apply_ipa_transforms): Inline into only caller ...
(execute_one_pass): ... here. Properly bring in function
bodies for nodes we want to apply IPA transforms to.
* gcc.dg/lto/pr60911_0.c: New testcase.
From-SVN: r209779
Diffstat (limited to 'gcc/passes.c')
-rw-r--r-- | gcc/passes.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/passes.c b/gcc/passes.c index 2be7856..fb60fc8 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -2039,20 +2039,6 @@ execute_all_ipa_transforms (void) } } -/* Callback for do_per_function to apply all IPA transforms. */ - -static void -apply_ipa_transforms (void *data) -{ - struct cgraph_node *node = cgraph_get_node (current_function_decl); - if (!node->global.inlined_to && node->ipa_transforms_to_apply.exists ()) - { - *(bool *)data = true; - execute_all_ipa_transforms (); - rebuild_cgraph_edges (); - } -} - /* Check if PASS is explicitly disabled or enabled and return the gate status. FUNC is the function to be processed, and GATE_STATUS is the gate status determined by pass manager by @@ -2124,8 +2110,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. */ |