[RFH] Copyprop through aggregates

Richard Guenther rguenther@suse.de
Wed Jan 25 15:31:00 GMT 2006


> *************** copy_prop_visit_assignment (tree stmt, t
> *** 539,544 ****
> --- 558,625 ----
>     lhs = TREE_OPERAND (stmt, 0);
>     rhs = TREE_OPERAND (stmt, 1);
>   
> +   /* Try seeing through reference trees maybe finally ending up
> +      with a SSA_NAME (or constant - but that's for cprop).
> +      We might want to cache a (negative) outcome of get_ref_base_and_extent.  */
> +   if (TREE_CODE (rhs) != SSA_NAME)
> +     {
> +       /* See if we know exactly where this comes from.  */
> +       tree def;
> +       tree base;
> +       HOST_WIDE_INT offset, size, maxsize;
> +       tree base2;
> +       HOST_WIDE_INT offset2, size2, maxsize2;
> +       use_operand_p use;
> + 
> +       /* If we don't know where this comes from, bail out.  */
> +       base = get_ref_base_and_extent (rhs, &offset, &size, &maxsize);
> +       if (size == -1 || size != maxsize)
> + 	return SSA_PROP_VARYING;

restricting all to

     if (size == -1 || size != maxsize
          || !handled_component_p (base))
        return SSA_PROP_VARYING;

i.e. not handling f.i. pointer dereferences, makes it go further.

Richard.



More information about the Gcc-patches mailing list