* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
@ 2023-05-25 0:41 ` pinskia at gcc dot gnu.org
2023-05-25 0:45 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-25 0:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |8.5.0
Known to fail| |9.1.0
Target Milestone|--- |10.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
2023-05-25 0:41 ` [Bug tree-optimization/109960] " pinskia at gcc dot gnu.org
@ 2023-05-25 0:45 ` pinskia at gcc dot gnu.org
2023-05-25 0:58 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-25 0:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We could have a pattern that does:
`(a & CST) != 0 ? 1: (bool)a` -> `a & (CST|1) != 0` to fix this I think.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
2023-05-25 0:41 ` [Bug tree-optimization/109960] " pinskia at gcc dot gnu.org
2023-05-25 0:45 ` pinskia at gcc dot gnu.org
@ 2023-05-25 0:58 ` pinskia at gcc dot gnu.org
2023-05-25 2:29 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-25 0:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-05-25
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Or maybe extend recognize_single_bit_test to recognize (bool)a != 0 is the same
as a & 1 != 0.
Let me try that.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-05-25 0:58 ` pinskia at gcc dot gnu.org
@ 2023-05-25 2:29 ` pinskia at gcc dot gnu.org
2023-05-25 2:51 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-25 2:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|1 |0
Status|ASSIGNED |UNCONFIRMED
Assignee|pinskia at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Nope not working, even tried to figure out how to modify tree-ssa-reassoc.cc to
teach it about `(bool)a` being the same as `(a & 1) != 0` But I could not
figure out how.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-05-25 2:29 ` pinskia at gcc dot gnu.org
@ 2023-05-25 2:51 ` pinskia at gcc dot gnu.org
2023-05-25 7:59 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-25 2:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I happened to notice this because I am working on a match patch that transform
`a ? 1 : b` into `a | b`.
In the case of stmt_can_terminate_bb_p, I noticed we had:
<bb 31> [local count: 330920071]:
_48 = MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subcode;
_49 = _48 & 2;
if (_49 != 0)
goto <bb 33>; [34.00%]
else
goto <bb 32>; [66.00%]
<bb 32> [local count: 218407246]:
_50 = (bool) _48;
<bb 33> [local count: 940291388]:
# _13 = PHI <0(14), _50(32), _12(29), 0(11), 0(30), 1(2), 1(31), 0(25)>
And the patch to match would do:
<bb 31> [local count: 330920071]:
_48 = MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subcode;
_49 = _48 & 2;
_50 = (bool) _48;
_127 = _49 != 0;
_44 = _50 | _127;
<bb 32> [local count: 940291388]:
# _13 = PHI <0(14), 0(25), _12(29), 0(11), 0(30), 1(2), _44(31)>
Which is definitely better than before but I was like isn't that the same as:
_49 = _48 & 3;
_44 = _49 != 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-05-25 2:51 ` pinskia at gcc dot gnu.org
@ 2023-05-25 7:59 ` rguenth at gcc dot gnu.org
2023-07-07 10:45 ` [Bug tree-optimization/109960] [11/12/13/14 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-25 7:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
ifcombine was supposed to handle this but I guess we mess up before it
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-05-25 7:59 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:45 ` rguenth at gcc dot gnu.org
2023-09-16 22:55 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (6 preceding siblings ...)
2023-07-07 10:45 ` [Bug tree-optimization/109960] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2023-09-16 22:55 ` pinskia at gcc dot gnu.org
2023-09-16 23:04 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-16 22:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (7 preceding siblings ...)
2023-09-16 22:55 ` pinskia at gcc dot gnu.org
@ 2023-09-16 23:04 ` pinskia at gcc dot gnu.org
2023-09-17 1:27 ` pinskia at gcc dot gnu.org
2024-01-12 13:53 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-16 23:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55913
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55913&action=edit
part of the ifcombine fixes
It does not catch:
_10 = _5 >> 1;
_11 = (_Bool) _10;
if (_11 != 0)
Though. I will add that in a bit. That is used for PR 108370.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (8 preceding siblings ...)
2023-09-16 23:04 ` pinskia at gcc dot gnu.org
@ 2023-09-17 1:27 ` pinskia at gcc dot gnu.org
2024-01-12 13:53 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17 1:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55915
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55915&action=edit
match pattern for the non-ifcombine case
sometimes we need to handle this outside of ifcombine due to phiopt or other
passes. So this adds that pattern.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/109960] [11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0`
2023-05-25 0:40 [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` pinskia at gcc dot gnu.org
` (9 preceding siblings ...)
2023-09-17 1:27 ` pinskia at gcc dot gnu.org
@ 2024-01-12 13:53 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-12 13:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread