[Bug tree-optimization/102648] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) since r12-2381-g704e8a825c78b9a8

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

Andrew Macleod  changed:

   What|Removed |Added

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

--- Comment #4 from Andrew Macleod  ---
Should be fixed.

[Bug tree-optimization/102648] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) since r12-2381-g704e8a825c78b9a8

2021-11-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102648

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

https://gcc.gnu.org/g:1598bd47b2a4a5f12b5a987d16d82634644db4b6

commit r12-5524-g1598bd47b2a4a5f12b5a987d16d82634644db4b6
Author: Andrew MacLeod 
Date:   Thu Nov 25 08:58:19 2021 -0500

Add the testcase for this PR to the testsuite.

Various ranger-enabled patches like threading and VRP2 can do this now, so
add the testcase for posterity.

gcc/testsuite/
PR tree-optimization/102648
* gcc.dg/pr102648.c: New.

[Bug tree-optimization/102648] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) since r12-2381-g704e8a825c78b9a8

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

--- Comment #2 from Andrew Macleod  ---
This is another case of insufficient range representation in the old
value_range.  The patch causing the issue allows us to produce better subranges
when the source ranges have small numbers of constants in them.

We have the sequence:

g.8_18 = (unsigned short) _2;
_19 = g.8_18 * 4;
_20 = (short int) _19;
if (_20 > 1)

we calculate that g.8_18 has a range of [0,1]
before this patch, we calculated:

_19 = unsigned short ~[1, 3]
_20 =   short int [-25536, 0]
if (_20 > 1) could then be folded as never taken.

With the precision change, we calculate _19 as [0,0][4,4], which when
converted to a value range, becomes [0,4].  This then causes
_20 be calculated as short int ~[-25535, -1] 
which can no longer correctly predict that the branch can never be taken.

This problem goes away if we run another evrp instance later instead of VRP as
this is a non issue with multi-ranges as we get:

g.8_18 : unsigned short [0, 1]
_19 : unsigned short [0, 0][4, 4]
_20 : short int [-25536, -25536][0, 0]
and can easily fold away the condition.

[Bug tree-optimization/102648] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) since r12-2381-g704e8a825c78b9a8

2021-10-11 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102648

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
Summary|[12 Regression] Dead Code   |[12 Regression] Dead Code
   |Elimination Regression at   |Elimination Regression at
   |-O3 (trunk vs 11.2.0)   |-O3 (trunk vs 11.2.0) since
   ||r12-2381-g704e8a825c78b9a8
 Ever confirmed|0   |1
   Last reconfirmed||2021-10-11

--- Comment #1 from Martin Liška  ---
Started with r12-2381-g704e8a825c78b9a8.