[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2024-01-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #7 from Andrew Pinski  ---
Fixed.

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2024-01-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

--- Comment #6 from GCC Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:34a827039fabcf24ce78da25984a1cc8be7ca2c3

commit r14-7221-g34a827039fabcf24ce78da25984a1cc8be7ca2c3
Author: Andrew Pinski 
Date:   Fri Jan 12 20:24:34 2024 -0800

Add a few testcases for fix missed optimization regressions

Adds a few new testcases for some missed optimization regressions.
The analysis on how each should be optimized is in the testcases
themselves (and in the bug report).

Committed as obvious after running the testsuite to make sure they pass.

PR tree-optimization/107823
PR tree-optimization/110768
PR tree-optimization/110941
PR tree-optimization/110450
PR tree-optimization/110841

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/ssa-thread-22.c: New test.
* gcc.dg/tree-ssa/vrp-loop-1.c: New test.
* gcc.dg/tree-ssa/vrp-loop-2.c: New test.
* gcc.dg/tree-ssa/vrp-unreachable-1.c: New test.
* gcc.dg/tree-ssa/vrp-unreachable-2.c: New test.

Signed-off-by: Andrew Pinski 

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2024-01-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #5 from Andrew Pinski  ---
Will commit a testcase for this.
r14-5109-ga291237b628f41 is definitely the fix for this based on my analysis in
comment #2:
> GCC 13:
> Global Exported: _6 = [irange] unsigned int [0, 24] NONZERO 0x1e

> trunk:
> Global Exported: _6 = [irange] unsigned int [0, 24][+INF, +INF] MASK 0x1c 
> VALUE 0x0

The removal of `[+INF, +INF]` here fixes the issue earlier

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2024-01-10 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

Martin Jambor  changed:

   What|Removed |Added

 CC||jamborm at gcc dot gnu.org
   Keywords|needs-bisection |

--- Comment #4 from Martin Jambor  ---
This has been fixed with r14-5109-ga291237b628f41 (Andrew MacLeod: Remove
simple ranges from trailing zero bitmasks).

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2023-11-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||needs-bisection

--- Comment #3 from Andrew Pinski  ---
This seems to be fixed now. We are able to optimize out the call to foo even in
evrp now too.

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

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

--- Comment #2 from Andrew Pinski  ---
GCC 13:
Global Exported: _6 = [irange] unsigned int [0, 24] NONZERO 0x1e

trunk:
Global Exported: _6 = [irange] unsigned int [0, 24][+INF, +INF] MASK 0x1c VALUE
0x0


And then:
Folding predicate _6 > 24 to 0

does not happen.
But what is interesting is with
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629128.html ,
We get:
```
Simplified relational if (_6 > 24)
 into if (_6 == 4294967295)

Folded into: if (_6 == 4294967295)
```

And then during cfgcleanup the match pattern:
/* X == C (or X & Z == Y | C) is impossible if ~nonzero(X) & C != 0.  */
Hits which is totally funny because that means the range and nonzero
information are out of sync ...

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-08-08
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
  # RANGE [irange] unsigned int [0, 16][20, 20][24, 24][65532,
4294901776][4294967293, +INF] MASK 0xfffc VALUE 0x0
  # ivtmp.18_37 = PHI 
  # RANGE [irange] unsigned short [0, +INF] MASK 0xfffc VALUE 0xfffc
  _21 = (unsigned short) ivtmp.18_37;
  if (_21 <= 24)


Confirmed. The range for _21 is way to conserative.
It should have been: `[0, 16][20, 20][24, 24]`.

[Bug tree-optimization/110941] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c

2023-08-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110941

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |14.0