* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
@ 2022-10-06 10:02 ` rguenth at gcc dot gnu.org
2022-11-26 20:45 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-06 10:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-10-06
Status|UNCONFIRMED |NEW
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
2022-10-06 10:02 ` [Bug tree-optimization/107137] " rguenth at gcc dot gnu.org
@ 2022-11-26 20:45 ` pinskia at gcc dot gnu.org
2023-08-31 18:34 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-26 20:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=107765
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to PR 107765 (but not exactly a dup).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
2022-10-06 10:02 ` [Bug tree-optimization/107137] " rguenth at gcc dot gnu.org
2022-11-26 20:45 ` pinskia at gcc dot gnu.org
@ 2023-08-31 18:34 ` pinskia at gcc dot gnu.org
2023-09-01 2:27 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-31 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-08-31 18:34 ` pinskia at gcc dot gnu.org
@ 2023-09-01 2:27 ` pinskia at gcc dot gnu.org
2023-09-01 16:26 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-01 2:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2023-Septemb
| |er/629018.html
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629018.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-09-01 2:27 ` pinskia at gcc dot gnu.org
@ 2023-09-01 16:26 ` pinskia at gcc dot gnu.org
2023-09-02 7:01 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-01 16:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Solving this one is easier, just going with:
/* (nop_outer_cast)-(inner_cast)var -> -(outer_cast)(var)
if var is smaller in precision. */
(simplify
(convert (negate:s@1 (convert:s @0)))
(if (INTEGRAL_TYPE_P (type)
&& tree_nop_conversion_p (type, TREE_TYPE (@1))
&& TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (@0)))
(negate (convert @0))))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-09-01 16:26 ` pinskia at gcc dot gnu.org
@ 2023-09-02 7:01 ` pinskia at gcc dot gnu.org
2023-09-05 21:16 ` cvs-commit at gcc dot gnu.org
2023-09-05 21:16 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-02 7:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL|https://gcc.gnu.org/piperma |https://gcc.gnu.org/piperma
|il/gcc-patches/2023-Septemb |il/gcc-patches/2023-Septemb
|er/629018.html |er/629156.html
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Updated patch:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629156.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-09-02 7:01 ` pinskia at gcc dot gnu.org
@ 2023-09-05 21:16 ` cvs-commit at gcc dot gnu.org
2023-09-05 21:16 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-05 21:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:e6bcf83989478348428c732c11e6c0f1719e9214
commit r14-3721-ge6bcf83989478348428c732c11e6c0f1719e9214
Author: Andrew Pinski <apinski@marvell.com>
Date: Thu Aug 31 16:17:35 2023 -0700
MATCH: `(nop_convert)-(convert)a` into -(convert)a if we are converting
from something smaller
This allows removal of one conversion and in the case of booleans, might be
able to remove
the negate and the other conversion later on.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/107137
gcc/ChangeLog:
* match.pd (`(nop_convert)-(convert)a`): New pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/neg-cast-2.c: New test.
* gcc.dg/tree-ssa/neg-cast-3.c: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var
2022-10-03 19:40 [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var pinskia at gcc dot gnu.org
` (6 preceding siblings ...)
2023-09-05 21:16 ` cvs-commit at gcc dot gnu.org
@ 2023-09-05 21:16 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-05 21:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |14.0
Status|ASSIGNED |RESOLVED
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread