* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
@ 2021-07-21 7:01 ` rguenth at gcc dot gnu.org
2021-11-20 10:58 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-21 7:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-07-21
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
2021-07-21 7:01 ` [Bug tree-optimization/101541] " rguenth at gcc dot gnu.org
@ 2021-11-20 10:58 ` pinskia at gcc dot gnu.org
2021-11-20 22:03 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-20 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine, let me try to figure out the best way to fix this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
2021-07-21 7:01 ` [Bug tree-optimization/101541] " rguenth at gcc dot gnu.org
2021-11-20 10:58 ` pinskia at gcc dot gnu.org
@ 2021-11-20 22:03 ` pinskia at gcc dot gnu.org
2023-05-04 0:01 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-20 22:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Mine, let me try to figure out the best way to fix this.
Basically the patterns starting with:
/* abs/negative simplifications moved from fold_cond_expr_with_comparison,
Need to handle (A - B) case as fold_cond_expr_with_comparison does.
Need to handle UN* comparisons.
need to add nop_convertN? handling. There is 6 patterns.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2021-11-20 22:03 ` pinskia at gcc dot gnu.org
@ 2023-05-04 0:01 ` pinskia at gcc dot gnu.org
2023-10-15 16:59 ` 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-04 0:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another one missed:
```
unsigned abssat2 (unsigned x)
{
int y = x;
if (y < 0)
x = -x;
return x;
}
```
I have a patch for the this case, I think. Working on the other case now.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-05-04 0:01 ` pinskia at gcc dot gnu.org
@ 2023-10-15 16:59 ` pinskia at gcc dot gnu.org
2023-10-15 17:42 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-15 16:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually using bitwise_equal_p makes this easier and no need for the
nop_convert ...
I have a patch where I just need to add testcases too.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-10-15 16:59 ` pinskia at gcc dot gnu.org
@ 2023-10-15 17:42 ` pinskia at gcc dot gnu.org
2023-10-15 19:24 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-15 17:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56116
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56116&action=edit
Patch which I am testing
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-10-15 17:42 ` pinskia at gcc dot gnu.org
@ 2023-10-15 19:24 ` pinskia at gcc dot gnu.org
2023-10-15 22:00 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-15 19:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56118
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56118&action=edit
Patch which I am testing which allows for more (independent of the other)
This patch improves the case where we have a conversion at the end (after the
negate expression). And with both of these patches together we are able to
catch almost all.
There is one more phi-opt patch needed to catch the case where the conversion
before the negate expression is conditional but that is for another day.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (6 preceding siblings ...)
2023-10-15 19:24 ` pinskia at gcc dot gnu.org
@ 2023-10-15 22:00 ` pinskia at gcc dot gnu.org
2023-10-16 17:11 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-15 22:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2023-October
| |/633043.html
Keywords| |patch
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633043.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (7 preceding siblings ...)
2023-10-15 22:00 ` pinskia at gcc dot gnu.org
@ 2023-10-16 17:11 ` cvs-commit at gcc dot gnu.org
2023-10-16 17:15 ` pinskia at gcc dot gnu.org
2023-10-24 11:17 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-16 17:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #9 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:c7609acb8a8210188d21b2cd72ecc6d3b2de2ab8
commit r14-4662-gc7609acb8a8210188d21b2cd72ecc6d3b2de2ab8
Author: Andrew Pinski <pinskia@gmail.com>
Date: Sun Oct 15 10:36:56 2023 -0700
MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
This improves the `A CMP 0 ? A : -A` set of match patterns to use
bitwise_equal_p which allows an nop cast between signed and unsigned.
This allows catching a few extra cases which were not being caught before.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
PR tree-optimization/101541
* match.pd (A CMP 0 ? A : -A): Improve
using bitwise_equal_p.
gcc/testsuite/ChangeLog:
PR tree-optimization/101541
* gcc.dg/tree-ssa/phi-opt-36.c: New test.
* gcc.dg/tree-ssa/phi-opt-37.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (8 preceding siblings ...)
2023-10-16 17:11 ` cvs-commit at gcc dot gnu.org
@ 2023-10-16 17:15 ` pinskia at gcc dot gnu.org
2023-10-24 11:17 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-16 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |14.0
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/101541] Missing ABSU detection at gimple
2021-07-20 22:58 [Bug tree-optimization/101541] New: Missing ABSU detection at gimple pinskia at gcc dot gnu.org
` (9 preceding siblings ...)
2023-10-16 17:15 ` pinskia at gcc dot gnu.org
@ 2023-10-24 11:17 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-24 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541
--- Comment #11 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:0fc13e8c0e39c51e82deb93f324d9d86ad8d7460
commit r14-4889-g0fc13e8c0e39c51e82deb93f324d9d86ad8d7460
Author: Andrew Pinski <pinskia@gmail.com>
Date: Sun Oct 15 19:15:38 2023 +0000
Improve factor_out_conditional_operation for conversions and constants
In the case of a NOP conversion (precisions of the 2 types are equal),
factoring out the conversion can be done even if int_fits_type_p returns
false and even when the conversion is defined by a statement inside the
conditional. Since it is a NOP conversion there is no zero/sign extending
happening which is why it is ok to be done here; we were trying to prevent
an extra sign/zero extend from being moved away from definition which no-op
conversions are not.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
PR tree-optimization/104376
PR tree-optimization/101541
* tree-ssa-phiopt.cc (factor_out_conditional_operation):
Allow nop conversions even if it is defined by a statement
inside the conditional.
gcc/testsuite/ChangeLog:
PR tree-optimization/101541
* gcc.dg/tree-ssa/phi-opt-39.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread