[graphite] fix quality of generated code
Sebastian Pop
sebpop@gmail.com
Sun Jan 11 00:25:00 GMT 2009
On Sat, Jan 10, 2009 at 5:44 PM, Daniel Berlin <dberlin@dberlin.org> wrote:
> How is PRE failing when you try to schedule it?
>
PRE fails because we're in loop optimizations mode and PRE tries to init
and free current_loops. PRE passes when scheduled after graphite, at
least on the testcase for PR38786, with this patch:
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c (revision 143190)
+++ tree-ssa-pre.c (working copy)
@@ -4173,7 +4173,7 @@ init_pre (bool do_fre)
/* Deallocate data structures used by PRE. */
static void
-fini_pre (bool do_fre)
+fini_pre (bool do_fre, bool in_loop_opt)
{
basic_block bb;
@@ -4203,7 +4203,7 @@ fini_pre (bool do_fre)
BITMAP_FREE (need_eh_cleanup);
- if (!do_fre)
+ if (!do_fre && !in_loop_opt)
loop_optimizer_finalize ();
}
@@ -4213,13 +4213,14 @@ fini_pre (bool do_fre)
static unsigned int
execute_pre (bool do_fre ATTRIBUTE_UNUSED)
{
+ bool in_loop_opt = (current_loops != NULL);
unsigned int todo = 0;
do_partial_partial = optimize > 2;
/* This has to happen before SCCVN runs because
loop_optimizer_init may create new phis, etc. */
- if (!do_fre)
+ if (!do_fre && !in_loop_opt)
loop_optimizer_init (LOOPS_NORMAL);
if (!run_scc_vn (do_fre))
@@ -4227,7 +4228,8 @@ execute_pre (bool do_fre ATTRIBUTE_UNUSE
if (!do_fre)
{
remove_dead_inserted_code ();
- loop_optimizer_finalize ();
+ if (!in_loop_opt)
+ loop_optimizer_finalize ();
}
return 0;
@@ -4283,7 +4285,7 @@ execute_pre (bool do_fre ATTRIBUTE_UNUSE
if (!do_fre)
remove_dead_inserted_code ();
- fini_pre (do_fre);
+ fini_pre (do_fre, in_loop_opt);
return todo;
}
More information about the Gcc-patches
mailing list