Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-12-06 Thread Marc Glisse
On Thu, 26 Nov 2020, Jakub Jelinek via Gcc-patches wrote: For signed integers with undefined overflow we already optimize x * y / y into x, but for signed integers with -fwrapv or unsigned integers we don't. The following patch allows optimizing that into just x if value ranges prove that x * y

Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-11-30 Thread Andrew MacLeod via Gcc-patches
On 11/26/20 3:52 AM, Jakub Jelinek wrote: Hi! For signed integers with undefined overflow we already optimize x * y / y into x, but for signed integers with -fwrapv or unsigned integers we don't. The following patch allows optimizing that into just x if value ranges prove that x * y will never

Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-11-26 Thread Richard Biener
On Thu, 26 Nov 2020, Jakub Jelinek wrote: > On Thu, Nov 26, 2020 at 09:24:30AM +, Richard Biener wrote: > > > For signed integers with undefined overflow we already optimize x * y / y > > > into x, but for signed integers with -fwrapv or unsigned integers we > > > don't. > > > The following

Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-11-26 Thread Jakub Jelinek via Gcc-patches
On Thu, Nov 26, 2020 at 09:24:30AM +, Richard Biener wrote: > > For signed integers with undefined overflow we already optimize x * y / y > > into x, but for signed integers with -fwrapv or unsigned integers we don't. > > The following patch allows optimizing that into just x if value ranges >

Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-11-26 Thread Richard Biener
On Thu, 26 Nov 2020, Jakub Jelinek wrote: > Hi! > > For signed integers with undefined overflow we already optimize x * y / y > into x, but for signed integers with -fwrapv or unsigned integers we don't. > The following patch allows optimizing that into just x if value ranges > prove that x * y

[PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]

2020-11-26 Thread Jakub Jelinek via Gcc-patches
Hi! For signed integers with undefined overflow we already optimize x * y / y into x, but for signed integers with -fwrapv or unsigned integers we don't. The following patch allows optimizing that into just x if value ranges prove that x * y will never overflow. It uses the global