[Bug tree-optimization/88575] gcc got confused by different comparison operators

2025-01-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |15.0

[Bug tree-optimization/88575] gcc got confused by different comparison operators

2025-01-21 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575
Bug 88575 depends on bug 110199, which changed state.

Bug 110199 Summary: [12/13 Regression] Missing VRP transformation with MIN_EXPR 
and known relation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110199

   What|Removed |Added

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

[Bug tree-optimization/88575] gcc got confused by different comparison operators

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

Andrew Macleod  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 CC||amacleod at redhat dot com

--- Comment #8 from Andrew Macleod  ---
I believe this is fixed now.

[Bug tree-optimization/88575] gcc got confused by different comparison operators

2025-01-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575

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

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

commit r15-6815-gb0eeb540497c7b9dee01f8724f9a4978b53a12ae
Author: Andrew MacLeod 
Date:   Fri Jan 10 13:33:01 2025 -0500

Use relations when simplifying MIN and MAX.

Query for known relations between the operands, and pass that to
fold_range to help simplify MIN and MAX relations.
Make it type agnostic as well.

Adapt testcases from DOM to EVRP (e suffix) and test floats (f suffix).

PR tree-optimization/88575
gcc/
* vr-values.cc (simplify_using_ranges::fold_cond_with_ops): Query
relation between op0 and op1 and utilize it.
(simplify_using_ranges::simplify): Do not eliminate float checks.

gcc/testsuite/
* gcc.dg/tree-ssa/minmax-27.c: Disable VRP.
* gcc.dg/tree-ssa/minmax-27e.c: New.
* gcc.dg/tree-ssa/minmax-27f.c: New.
* gcc.dg/tree-ssa/minmax-28.c: Disable VRP.
* gcc.dg/tree-ssa/minmax-28e.c: New.
* gcc.dg/tree-ssa/minmax-28f.c: New.

[Bug tree-optimization/88575] gcc got confused by different comparison operators

2023-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||110199

--- Comment #6 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #5)
> So VRP handles floating point now but it still does not optimize it:
> Folding statement: if (a_2(D) <= b_3(D))
>  Registering value_relation (a_2(D) <= b_3(D)) on (2->3)
> 
> Visiting conditional with predicate: if (a_2(D) <= b_3(D))
> 
> With known ranges
>   a_2(D): [frange] double VARYING b_3(D): [frange] double VARYING
> 
> Predicate evaluates to: DON'T KNOW
> Not folded
> Folding statement: _4 = MIN_EXPR ;
> Not folded
> 
> 
> While the int does this:
> Folding statement: _4 = MIN_EXPR ;
>  folding with relation a_2(D) <= b_3(D)
> Global Exported: _4 = [irange] int [-INF, 2147483646]
> Not folded
> 
> Which is a regression from GCC 12 

I filed PR 110199 for that.  Maybe once that is fixed the FP case will work
too.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110199
[Bug 110199] [12/13/14 Regression] Missing VRP transformation with MIN_EXPR and
known relation

[Bug tree-optimization/88575] gcc got confused by different comparison operators

2023-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2019-01-02 00:00:00 |2023-6-9

--- Comment #5 from Andrew Pinski  ---
So VRP handles floating point now but it still does not optimize it:
Folding statement: if (a_2(D) <= b_3(D))
 Registering value_relation (a_2(D) <= b_3(D)) on (2->3)

Visiting conditional with predicate: if (a_2(D) <= b_3(D))

With known ranges
a_2(D): [frange] double VARYING b_3(D): [frange] double VARYING

Predicate evaluates to: DON'T KNOW
Not folded
Folding statement: _4 = MIN_EXPR ;
Not folded


While the int does this:
Folding statement: _4 = MIN_EXPR ;
 folding with relation a_2(D) <= b_3(D)
Global Exported: _4 = [irange] int [-INF, 2147483646]
Not folded

Which is a regression from GCC 12 

[Bug tree-optimization/88575] gcc got confused by different comparison operators

2021-07-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575

Andrew Pinski  changed:

   What|Removed |Added

  Component|middle-end  |tree-optimization
   Severity|normal  |enhancement