[Bug tree-optimization/83072] Late VRP optimization

2022-01-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug tree-optimization/83072] Late VRP optimization

2022-01-13 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

Andrew Macleod  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Andrew Macleod  ---
Fixed.  Just needed to enable multi-ranges in fold_const.

[Bug tree-optimization/83072] Late VRP optimization

2022-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

https://gcc.gnu.org/g:49d5fb4feee831868d80fff4d024c271911c92ca

commit r12-6559-g49d5fb4feee831868d80fff4d024c271911c92ca
Author: Andrew MacLeod 
Date:   Wed Jan 12 13:31:08 2022 -0500

Allow more precision when querying from fold_const.

fold_const::expr_not_equal_to queries for a current range, but still uses
the old value_range class.  This is causing it to miss opportunities when
ranger can provide something better.

PR tree-optimization/83072
PR tree-optimization/83073
PR tree-optimization/97909
gcc/
* fold-const.c (expr_not_equal_to): Use a multi-range class.

gcc/testsuite/
* gcc.dg/pr83072-2.c: New.
* gcc.dg/pr83073.c: New.

[Bug tree-optimization/83072] Late VRP optimization

2020-11-17 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #8 from Andrew Macleod  ---
I've adjusted range-ops so that EVRP will recognize that
   c |= 1
is a non-zero range, and I've added a test case to check it.

The rest of this PR involves exposing ranges in a better way to fold-const.

Next release this should be covered.. we have a couple of options for exposing
the new value-query API to fold_const and other consumers of the current
get_range_info global interface. 

It's in the work queue to enable accessing the current ranger instance when its
available, and fallback to the latest global value when there isn't one
running.

This should resolve this PR... stay tuned.

[Bug tree-optimization/83072] Late VRP optimization

2020-11-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

https://gcc.gnu.org/g:a5f9c27bfc4417224e332392bb81a2d733b2b5bf

commit r11-5105-ga5f9c27bfc4417224e332392bb81a2d733b2b5bf
Author: Andrew MacLeod 
Date:   Tue Nov 17 10:04:38 2020 -0500

IOR with nonzero, range cannot contain 0.

Remove zero from IOR ranges with non-zero masks.

gcc/
PR tree-optimization/83072
* range-op.cc (wi_optimize_and_or): Remove zero from IOR range when
mask is non-zero.
gcc/testsuite/
* gcc.dg/pr83072.c: New.

[Bug tree-optimization/83072] Late VRP optimization

2019-07-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
 CC||amacleod at redhat dot com
 Blocks||85316
   Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot 
gnu.org

--- Comment #6 from Richard Biener  ---
Andrew is now maintaining VRP.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

[Bug tree-optimization/83072] Late VRP optimization

2017-11-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #5 from Richard Biener  ---
The testcase is now optimized early during evrp after r255201.  We still don't
record temporary ranges in SSA range info but we can perform the unreachable ()
trick VRP has.

[Bug tree-optimization/83072] Late VRP optimization

2017-11-22 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #4 from rguenther at suse dot de  ---
On Tue, 21 Nov 2017, glisse at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072
> 
> --- Comment #3 from Marc Glisse  ---
> (In reply to Richard Biener from comment #2)
> > The issue is that when EVRP records value-ranges that only hold temporarily
> > it doesn't update SSA_NAME_RANGE_INFO but only the internal lattice while
> > if the range is determined at the SSA definition point it also updates
> > SSA_NAME_RANGE_INFO.
> 
> Seems obvious now you've said it... And VRP1, which would have a separate
> SSA_NAME, does not generally call into match-simplify yet.
> 
> I wonder if we'll take the ugly route of making the EVRP lattice global, and
> having get_range_info use it if it isn't empty (or checking some flag) and 
> fall
> back to the current behavior otherwise. Seems simpler and cheaper than the
> alternatives I am trying to think about.

Once Jeff is settlet with his re-orgs I'm going to simply temporarily
adjust SSA_NAME_RANGE_INFO.  Should be a very simple thing do to.

[Bug tree-optimization/83072] Late VRP optimization

2017-11-21 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #3 from Marc Glisse  ---
(In reply to Richard Biener from comment #2)
> The issue is that when EVRP records value-ranges that only hold temporarily
> it doesn't update SSA_NAME_RANGE_INFO but only the internal lattice while
> if the range is determined at the SSA definition point it also updates
> SSA_NAME_RANGE_INFO.

Seems obvious now you've said it... And VRP1, which would have a separate
SSA_NAME, does not generally call into match-simplify yet.

I wonder if we'll take the ugly route of making the EVRP lattice global, and
having get_range_info use it if it isn't empty (or checking some flag) and fall
back to the current behavior otherwise. Seems simpler and cheaper than the
alternatives I am trying to think about.

[Bug tree-optimization/83072] Late VRP optimization

2017-11-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

--- Comment #2 from Richard Biener  ---
The interesting bit is that during the stmt folding

/* For integral types with undefined overflow and C != 0 fold
   x * C EQ/NE y * C into x EQ/NE y.  */
(for cmp (eq ne)
 (simplify
  (cmp (mult:c @0 @1) (mult:c @2 @1))
  (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
   && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))
   && tree_expr_nonzero_p (@1))
   (cmp @0 @2

has to apply.

The issue is that when EVRP records value-ranges that only hold temporarily
it doesn't update SSA_NAME_RANGE_INFO but only the internal lattice while
if the range is determined at the SSA definition point it also updates
SSA_NAME_RANGE_INFO.

[Bug tree-optimization/83072] Late VRP optimization

2017-11-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-11-20
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
I will have a look (after Jeff is finished moving stuff around).