This is the mail archive of the
mailing list for the GCC project.
Re: [patch] More TRUNC_MOD_EXPR folding
- From: Jeffrey A Law <law at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: "James A. Morrison" <ja2morri at csclub dot uwaterloo dot ca>, gcc-patches at gcc dot gnu dot org
- Date: Sat, 18 Jun 2005 08:14:50 -0600
- Subject: Re: [patch] More TRUNC_MOD_EXPR folding
- References: <Pine.LNX.firstname.lastname@example.org>
- Reply-to: law at redhat dot com
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