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]

[PATCH] Fix IV-opts so it no longer produces MEM[index:]


Hi,
  The problem here is that add_candidate_1 is using generic_type_for which 
causes the pointer type be converted over to sizetype and so when we go to 
use that candidate, we create MEM[index:].  This changes that and fixes up 
all the fallout in the testsuite I could find (including two new issues 
which showed up after the summit, I had originally tested it before the 
summit but I decided to test it again before submitting it).  The fall out 
is having tree-affine use sizetype of the steps, fixing up add_to_parts to 
use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers, create_iv use 
sizetype variable for the step for pointer types, and also fixing up parts 
of iv-opts to use sizetype for steps.  The main reason why I am doing this 
is to reduce the memory usage after IV-opts and also so maybe we can rerun 
may_alias after iv-opts and not get confused as much and it is nice to see 
no cast from pointer types to sizetype in the code any more and I think it 
also helps out with the REG_POINTER issue when I get rid of the 
DECL_AFTICIAL clause as we have a real pointer type here now.


OK? Bootstrapped and tested on i686-linux-gnu and powerpc64-linux-gnu with 
no regressions.

Thank,
Andrew Pinski

ChangeLog:

        * tree-ssa-loop-manip.c (create_iv): Use a new temp
        variable for the step with the correct type.
        * tree-ssa-loop-ivopts.c (find_bivs): Convert the step
        to sizetype if type is a pointer type.
        (add_candidate_1): Don't convert the base and step to
        the generic type if the orginal type is a pointer type.
        (add_iv_value_candidates): Use sizetype for the step
        if type is a pointer type.
        (cand_value_at): Likewise.
        * tree-ssa-address.c (add_to_parts): Use POINTER_PLUS_EXPR
        for pointer types.
        * tree-affine.c (tree_to_aff_combination <POINTER_PLUS_EXPR>):
        Don't convert the tem affine to the type.
        (add_elt_to_tree): Use sizetype for the step if a pointer.
        Use POINTER_PLUS_EXPR for pointers.
        (aff_combination_to_tree): Use sizetype for the step if a
        pointer.


Attachment: fixupivopts-real.diff.txt
Description: Text document


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