[PATCH][mem-ref] Re-enable IVOPTs, build MEM_REF instead of TARGET_MEM_REF (help!)

Zdenek Dvorak rakdver@kam.mff.cuni.cz
Sun Mar 9 21:15:00 GMT 2008


Hi,

> On Sun, 9 Mar 2008, Richard Guenther wrote:
> 
> > On Sun, 9 Mar 2008, Richard Guenther wrote:
> > 
> > > 
> > > This patch (tries to) enables IVOPTs again and replaces built
> > > TARGET_MEM_REFs with MEM_REFs or INDIRECT_MEM_REFs instead.  It works
> > > nicely apart from IVOPTs sometimes (well, a lot of times) tries
> > > to force me to build a memory access with just an integer index!?
> > 
> > Andrew pointed me to PR31358 and
> > 
> > http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00423.html
> > 
> > which with a quick test seems to solve this problem.  I'm giving
> > it some more testing on the branch now.
> 
> I bootstrapped and tested the above patch on x86_64-unknown-linux-gnu,
> do you mind if I apply it to trunk?  I see you approved parts of it
> already.

the changes except for those in tree-affine.c are ok.

The tree-affine.c changes are a bit dubious; given affine combination i
+ p + j, where i and j are of sizetype and p is of type char *,  it will
produce (char *) i pointer_plus (sizetype) p pointer_plus j, instead of
p pointer_plus (i+j) or (p pointer_plus i) pointer_plus j.  Expression
simplification may (or may not -- I did not check) fix these casts, but it
would be better for aff_combination_to_tree just produced the correct
expression instead.  A simple way to do that is to
initialize expr in aff_combination_to_tree to a pointer-type element of
the affine combination (and exclude this element from the
add_elt_to_tree loop, of course).

Zdenek



More information about the Gcc-patches mailing list