[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt since r17-231

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

Drea Pinski  changed:

   What|Removed |Added

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

--- Comment #7 from Drea Pinski  ---
Fixed sorry for the breakage.

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt since r17-231

2026-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125234

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

https://gcc.gnu.org/g:5e933bd275f0e6eef18692ef351cb5d617f48d51

commit r17-418-g5e933bd275f0e6eef18692ef351cb5d617f48d51
Author: Andrew Pinski 
Date:   Fri May 8 12:46:32 2026 -0700

match: Fix merged patterns for a!=b implies a and b are not zero [PR125234]

In r17-231-gc65691bc5a2873, I messed up the resulting constant for
`(a != b) & ((a | b) == 0)` and `(a == b) | ((a | b) != 0)`. I had
swapped which one was resulting in true/false. This fixes the issue
and adds a testcase to make sure it does not regress again.

Pushed as obvious after a bootstrap/test on x86_64-linux-gnu.

PR tree-optimization/125234

gcc/ChangeLog:

* match.pd (`(a !=/== b) &\| ((a|b) ==/!= 0)`): Fix
resulting constant form.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr125234-1.c: New test.

Signed-off-by: Andrew Pinski 

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt since r17-231

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

--- Comment #5 from Drea Pinski  ---
Created attachment 64399
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64399&action=edit
Patch which I am testing

I will push this as obvious once my testing is finished.
I will also slow down and add testcases even when simplifying the match
patterns next time too.

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt since r17-231

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

Drea Pinski  changed:

   What|Removed |Added

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

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt since r17-231

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

Drea Pinski  changed:

   What|Removed |Added

Summary|[17 Regression] wrong code  |[17 Regression] wrong code
   |for int-bwise-opt   |for int-bwise-opt since
   ||r17-231

--- Comment #4 from Drea Pinski  ---
0,0 case
(a != b) & ((a | b) == 0)
(0 != 0) & ((0|0) == 0)
false&   true
   false

(a == b) | ((a|b) != 0)
(0 == 0) | ((0|0) != 0)
true |  false
true

1,0 case:
(1 != 0) & ((1|0) == 0)
true &   false
   false

(1 == 0) | ((1|0) != 0)
false|true
true

(In reply to Richard Biener from comment #3)
> The folding result needs to be (neeql @0 @1), not a constant, no?

No, I swapped around the comparison when I simplified it. It should have been
`bitop==BIT_IOR_EXPR`. 

r17-231-gc65691bc5a2873

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt

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

--- Comment #3 from Richard Biener  ---
The folding result needs to be (neeql @0 @1), not a constant, no?

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt

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

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
I think r16-4219-g5193b9d250a8ec

[Bug tree-optimization/125234] [17 Regression] wrong code for int-bwise-opt

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

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed||2026-05-08
   Priority|P3  |P1
Summary|wrong code for  |[17 Regression] wrong code
   |int-bwise-opt   |for int-bwise-opt
 Status|UNCONFIRMED |NEW
   Keywords||wrong-code
 Ever confirmed|0   |1
   Target Milestone|--- |17.0

--- Comment #1 from Richard Biener  ---
(for bitop (bit_and bit_ior)
 neeql (ne  eq)
 neeqr (eq  ne)
 (simplify
  (bitop (neeql @0 @1) (neeqr (bit_ior @0 @1) integer_zerop))
  { constant_boolean_node (bitop==BIT_AND_EXPR, type); }))

Confirmed.