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]

Re: [patch] More TRUNC_MOD_EXPR folding


On Sat, 2005-06-18 at 07:39 -0600, Roger Sayle wrote:
> On Fri, 17 Jun 2005, Jeffrey A Law wrote:
> > On Fri, 2005-06-17 at 17:07 -0400, James A. Morrison wrote:
> > >   This patch allows signed typed TRUNC_MOD_EXPRs to be folded to AND if the
> > > value is known to be positive.  E.g. abs(x) % 8 -> abs(x) & 7;
> >
> > Umm, it seems to me this ought to be caught by the recent changes
> > I made to tree-vrp.c.  Is there some pressing reason to do this
> > transformation in multiple places?
> 
> Whilst I agree that its often not desirable to have an identical
> transformation in multiple places, its usually better to place such
> transformations in the "shared" infrastructure such as fold-const.c
> where it can be reused during gimplification, RTL expansion and all
> of the tree-ssa passes, rather than in a single pass such as VRP.
> 
> I presume that the transformations in VRP all have the benefit of
> using additional range information not available to fold, in which
> case the minor duplication is reasonable.  Otherwise, it would make
> sense to place them in "fold" and remove the duplication elsewhere.
The transformations in VRP use range data that is not currently
available to the folder.

The stuff that was added to the folder is a trivial case that really,
really, really is better handled by the VRP stuff I recently checked
in.

jeff



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