[Bug middle-end/69526] ivopts candidate strangeness

2016-07-11 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #25 from rdapp at linux dot vnet.ibm.com --- Created attachment 38875 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38875&action=edit Updated patch and test, math.pd/VRP Some cleanups and fixes, the patch can now handle more ca

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-27 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #24 from rdapp at linux dot vnet.ibm.com --- Created attachment 38775 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38775&action=edit Updated patch and test, match.pd/VRP (In reply to amker from comment #23) > Hmm, not sure if

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-24 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #23 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #19) > (In reply to rguent...@suse.de from comment #18) > 2. > Is there an idiomatic/correct way to check a VR_RANGE for overflow? Does it > suffice to check if the

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-24 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #22 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #21) > (In reply to amker from comment #20) > > IIUC we can simply handle signed/unsigned type differently. Given a has > > int/uint type. > > For unsigned case: (

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-23 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 rdapp at linux dot vnet.ibm.com changed: What|Removed |Added Version|6.0 |unknown --- Comment #21

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-23 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #20 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #19) > (In reply to rguent...@suse.de from comment #18) > > > > The match.pd patch is slowly assuming shape... Two things however I'm still > unsure about: > > 1.

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-23 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #19 from rdapp at linux dot vnet.ibm.com --- (In reply to rguent...@suse.de from comment #18) > The match.pd patch is slowly assuming shape... Two things however I'm still unsure about: 1. An existing rule in match.pd checks for over

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-08 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #18 from rguenther at suse dot de --- On Tue, 7 Jun 2016, rdapp at linux dot vnet.ibm.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 > > --- Comment #15 from rdapp at linux dot vnet.ibm.com --- > Thanks for the sugg

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-07 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #17 from rdapp at linux dot vnet.ibm.com --- (In reply to Marc Glisse from comment #16) > (In reply to rdapp from comment #15) > > Is there a simple method to access @inner when > > capturing > > (outer_op (convert (inner_op SSA_NAME@0

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-07 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #16 from Marc Glisse --- (In reply to rdapp from comment #15) > Is there a simple method to access @inner when > capturing > (outer_op (convert (inner_op SSA_NAME@0 INTEGER_CST@1)) INTEGER_CST@2)) >^---

[Bug middle-end/69526] ivopts candidate strangeness

2016-06-07 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #15 from rdapp at linux dot vnet.ibm.com --- Thanks for the suggestions. The omission of the inner op was actually more or less on purpose as I intended to capture the (convert @inner) in order to access @inner's value range as a whole

[Bug middle-end/69526] ivopts candidate strangeness

2016-05-23 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #14 from rguenther at suse dot de --- On Fri, 20 May 2016, rdapp at linux dot vnet.ibm.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 > > --- Comment #13 from rdapp at linux dot vnet.ibm.com --- > Created attachment

[Bug middle-end/69526] ivopts candidate strangeness

2016-05-20 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #13 from rdapp at linux dot vnet.ibm.com --- Created attachment 38535 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38535&action=edit VRP/match.pd patch Found some time again and hacked together a fix for match.pd and VRP. The

[Bug middle-end/69526] ivopts candidate strangeness

2016-03-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #12 from Richard Biener --- So, we don't optimize at -O2 long foo (int a) { return (long)(a + 1) - 1; } Note that (T)(A +- CST1) +- CST2 -> (T)A +- CST3 thus the combined addition in general needs to be done in the larger type _un

[Bug middle-end/69526] ivopts candidate strangeness

2016-03-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #11 from Richard Biener --- (In reply to rdapp from comment #10) > Created attachment 38144 [details] > Tentative patch for VRP and loop-doloop > > Meanwhile I found the time to implement a pattern for VRP which seems to do > the job

[Bug middle-end/69526] ivopts candidate strangeness

2016-03-31 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #10 from rdapp at linux dot vnet.ibm.com --- Created attachment 38144 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38144&action=edit Tentative patch for VRP and loop-doloop Meanwhile I found the time to implement a pattern for

[Bug middle-end/69526] ivopts candidate strangeness

2016-03-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #9 from Richard Biener --- Note that VRP figures out that _15 = n_18 + 4294967295; Found new range for _15: [0, 4294967294] (so no underflow) _2 = (sizetype) _15; Found new range for _2: [0, 4294967294] _1 = _2 + 1; Found new range

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #8 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #7) > (In reply to amker from comment #6) > > > It comes from loop niter analysis, as in may_eliminate_iv, we have: > > > > (gdb) call debug_generic_expr(desc->nite

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #7 from rdapp at linux dot vnet.ibm.com --- (In reply to amker from comment #6) > It comes from loop niter analysis, as in may_eliminate_iv, we have: > > (gdb) call debug_generic_expr(desc->niter) > n_5(D) + 4294967295 and this is c

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #6 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #5) > I still don't quite get why the "n - 1" is needed. Do we need it to possibly > have an exit condition like > > if (i != n-1) or > if (i <= n-1)? > > Am I m

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #5 from rdapp at linux dot vnet.ibm.com --- I still don't quite get why the "n - 1" is needed. Do we need it to possibly have an exit condition like if (i != n-1) or if (i <= n-1)? Am I missing something really obvious here?

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #4 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #2) > Ok, that's sensible but why is the - 1 necessary in the first place? > > n_5 - 1 can only underflow if n_5 == 0 which is checked by > > testl %edx, %edx > >

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #3 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #2) > Ok, that's sensible but why is the - 1 necessary in the first place? > > n_5 - 1 can only underflow if n_5 == 0 which is checked by > > testl %edx, %edx > >

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 --- Comment #2 from rdapp at linux dot vnet.ibm.com --- Ok, that's sensible but why is the - 1 necessary in the first place? n_5 - 1 can only underflow if n_5 == 0 which is checked by testl %edx, %edx before. This is in a previous basic block,

[Bug middle-end/69526] ivopts candidate strangeness

2016-01-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526 Richard Biener changed: What|Removed |Added Keywords||missed-optimization Status|