This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/48702] [4.6/4.7 Regression] optimization regression with gcc-4.6 on x86_64-unknown-linux-gnu


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

--- Comment #16 from davidxl <xinliangli at gmail dot com> 2011-05-17 19:57:01 UTC ---
This is not really heuristic -- it prevents compiler from generating code in
ivopt that violates the aliasing assumption. 

David

(In reply to comment #15)
> Hi,
> 
> > The following patch fixes the problem. Is it ok?
> 
> as a heuristic, this probably makes sense.  Still, it does
> not fix the problem, just masks it and makes it harder to reproduce,
> 
> Zdenek
> 
> > David
> > 
> > 
> > --- tree-ssa-loop-ivopts.c      (revision 173278)
> > +++ tree-ssa-loop-ivopts.c      (working copy)
> > @@ -3968,7 +3968,7 @@ get_computation_cost_at (struct ivopts_d
> >                           int *inv_expr_id)
> >  {
> >    tree ubase = use->iv->base, ustep = use->iv->step;
> > -  tree cbase, cstep;
> > +  tree cbase, cstep, cbase_strip;
> >    tree utype = TREE_TYPE (ubase), ctype;
> >    unsigned HOST_WIDE_INT cstepi, offset = 0;
> >    HOST_WIDE_INT ratio, aratio;
> > @@ -4026,6 +4026,13 @@ get_computation_cost_at (struct ivopts_d
> >    if (!constant_multiple_of (ustep, cstep, &rat))
> >      return infinite_cost;
> > 
> > +  cbase_strip = STRIP_NOPS (cbase);
> > +  /* Avoid confusing aliaser.  */
> > +  if (TREE_CODE (cbase_strip) == ADDR_EXPR
> > +      && TREE_CODE (TREE_OPERAND (cbase_strip, 0)) == VAR_DECL
> > +      && (HOST_WIDE_INT) cstepi < 0)
> > +    return infinite_cost;
> > +
> >    if (double_int_fits_in_shwi_p (rat))
> >      ratio = double_int_to_shwi (rat);
> >    else
> > 
> > -- 
> > Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> > ------- You are receiving this mail because: -------
> > You are on the CC list for the bug.


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