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: [PATCH] Fix PR39132, wrong alias info after loop-distribution


Isn't this problem easier on the alias-improvements branch?
Can't we just collect the old vdefs and add them to the new call?

I can't fathom why we would need to recompute aliasing after changing
a loop into an equivalent function call.
It seems like we should be able to at least fix these trivial problems.
Recomputing aliasing is expensive and simply won't work in the face of IPA-PTA.

On Tue, Feb 10, 2009 at 9:50 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This is the usual problem of creating new pointers and no way to
> update SMTs / aliases.  The trick with using new_type_alias doesn't
> work here though, that only works with pointers to primitive types.
>
> Thus, we simply need to re-compute aliasing after memset creation
> in loop-distribution.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to
> trunk.
>
> Richard.
>
> 2009-02-10  Richard Guenther  <rguenther@suse.de>
>
>        PR tree-optimization/39132
>        * tree-loop-distribution.c (todo): New global var.
>        (generate_memset_zero): Trigger TODO_rebuild_alias.
>        (tree_loop_distribution): Return todo.
>
>        * gcc.dg/torture/pr39132.c: New testcase.
>
> Index: gcc/tree-loop-distribution.c
> ===================================================================
> *** gcc/tree-loop-distribution.c        (revision 144057)
> --- gcc/tree-loop-distribution.c        (working copy)
> *************** static bitmap remaining_stmts;
> *** 77,82 ****
> --- 77,85 ----
>     predecessor a node that writes to memory.  */
>  static bitmap upstream_mem_writes;
>
> + /* TODOs we need to run after the pass.  */
> + static unsigned int todo;
> +
>  /* Update the PHI nodes of NEW_LOOP.  NEW_LOOP is a duplicate of
>     ORIG_LOOP.  */
>
> *************** generate_memset_zero (gimple stmt, tree
> *** 331,336 ****
> --- 334,341 ----
>    if (dump_file && (dump_flags & TDF_DETAILS))
>      fprintf (dump_file, "generated memset zero\n");
>
> +   todo |= TODO_rebuild_alias;
> +
>   end:
>    free_data_ref (dr);
>    return res;
> *************** tree_loop_distribution (void)
> *** 1206,1211 ****
> --- 1211,1218 ----
>    loop_iterator li;
>    int nb_generated_loops = 0;
>
> +   todo = 0;
> +
>    FOR_EACH_LOOP (li, loop, 0)
>      {
>        VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3);
> *************** tree_loop_distribution (void)
> *** 1237,1243 ****
>        VEC_free (gimple, heap, work_list);
>      }
>
> !   return 0;
>  }
>
>  static bool
> --- 1244,1250 ----
>        VEC_free (gimple, heap, work_list);
>      }
>
> !   return todo;
>  }
>
>  static bool
> Index: gcc/testsuite/gcc.dg/torture/pr39132.c
> ===================================================================
> *** gcc/testsuite/gcc.dg/torture/pr39132.c      (revision 0)
> --- gcc/testsuite/gcc.dg/torture/pr39132.c      (revision 0)
> ***************
> *** 0 ****
> --- 1,33 ----
> + /* { dg-do run } */
> + /* { dg-options "-ftree-loop-distribution" } */
> +
> + extern void abort(void);
> +
> + struct epic_private
> + {
> +   unsigned int *rx_ring;
> +   unsigned int rx_skbuff[5];
> + };
> +
> + int
> + main (void)
> + {
> +   struct epic_private ep;
> +   unsigned int rx_ring[5];
> +   int i;
> +
> +   ep.rx_skbuff[0] = 5;
> +
> +   ep.rx_ring = rx_ring;
> +
> +   for (i = 0; i < 5; i++)
> +     {
> +       ep.rx_ring[i] = i;
> +       ep.rx_skbuff[i] = 0;
> +     }
> +
> +   if (ep.rx_skbuff[0] != 0)
> +     abort ();
> +
> +   return 0;
> + }
>


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