This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: VRP: rewrite the division code (to handle corner cases including 0)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 17 Oct 2018 12:51:52 +0200
- Subject: Re: VRP: rewrite the division code (to handle corner cases including 0)
- References: <e87874aa-bcbe-15bf-2a30-7dc694361850@redhat.com> <CAFiYyc0uuUBZEk-3oiUwO0Rx1Vz2nPKsopb7nT3Bv3ZzbHhecw@mail.gmail.com> <57739c4f-e341-ee44-45cb-72f28ca28f87@redhat.com> <CAFiYyc3OeoK8eCfQ57Y6Typ-En2NTFrcGS9bo8ygZu9Dray9DA@mail.gmail.com> <5e2c7455-f7f7-e440-4eda-35d2fff0a723@redhat.com>
On Wed, Oct 17, 2018 at 12:20 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>
>
>
> On 8/23/18 8:51 AM, Richard Biener wrote:
> > On Tue, Aug 21, 2018 at 7:35 PM Aldy Hernandez <aldyh@redhat.com> wrote:
> >>
> >>
> >>
> >> On 08/21/2018 05:46 AM, Richard Biener wrote:
> >>> On Wed, Aug 15, 2018 at 3:33 AM Aldy Hernandez <aldyh@redhat.com> wrote:
>
> >>> Yeah, nice work. Few comments:
> >>>
> >>> + TYPE_OVERFLOW_UNDEFINED (expr_type),
> >>> + TYPE_OVERFLOW_WRAPS (expr_type),
> >>>
> >>> we no longer have the third state !UNDEFINED && !WRAPS so I suggest
> >>> to eliminate one for the other (just pass TYPE_OVERFLOW_UNDEFINED).
> >>
> >> I'm confused. Then what shall I pass to
> >> wide_int_range_multiplicative_op within wide_int_range_div? Are you
> >> expecting to pass overflow_undefined to both the overflow_undefined and
> >> overflow_wraps arguments in multiplicative_op? Or are you saying I
> >> should get rid of overflow_wraps in both wide_int_range_div and
> >> wide_int_range_multiplicative_op (plus all other users of
> >> w_i_r_multiplicative_op)?
> >
> > Yes, overflow_wraps == !overflow_undefined (well, OK, not exactly - there's
> > also TYPE_OVERFLOW_TRAPS, but not for pointers).
> >
> > Let's sort this out as a followup. It somewhat felt odd / inconsistent.
> >
> > I think the wide-int routines want to know whether the operation may
> > overflow or not and if it may then it simply assumes wrapping behavior.
> > When overflow is undefined or if it traps the overflow isn't observed
> > in the result ...
>
> As promised, here is a patch merging the TYPE_OVERFLOW_UNDEFINED and
> TYPE_OVERFLOW_WRAPS flags in the wide_int_range* routines.
>
> OK pending tests?
OK.
Richard.
> Aldy