http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52436



--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-02 
08:27:51 UTC ---

The patch looks fine to me, though it might be a bit expensive.  I'd

re-organize it like



  if (TREE_INT_CST_LOW (arg1) % BITS_PER_UNIT == 0

      && TREE_INT_CST_LOW (arg2) % BITS_PER_UNIT == 0)

    {

      HOST_WIDE_INT coffset;

      tree base = get_addr_base_and_unit_offset (arg0, &coffset);

      if (base)

        return fold_build2 (MEM_REF, type,

                            build_fold_addr_expr (base),

                            build_int_cst (build_pointer_type

(TYPE_MAIN_VARIANT (type)), coffset + TREE_INT_CST_LOW (arg1) /

BITS_PER_UNIT));

    }



it avoids building a tree just to feed it into get_addr_base_and_unit_offset

It also avoids it if the access is not of byte-granularity which

get_addr_base_and_unit_offset does not even consider (it assumes it is fed

the argument of an ADDR_EXPR which obviously is byte-aligned).



The tree-flow-inline.h bits look ok.



I'm not sure what you need the forwprop / tree-ssa-propagate changes for.

Reply via email to