This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [graphite] fix quality of generated code


On Sun, Jan 11, 2009 at 1:23 AM, Sebastian Pop <sebpop@gmail.com> wrote:
> 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:

Well, we generally should try to not free the loop structures during
optimization
and only re-build them if they are not active.  The invariant needs to
be, of course,
that they are still correct after optimization.

Richard.

> 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;
>  }
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]