* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
@ 2021-11-14 6:30 ` pinskia at gcc dot gnu.org
2021-11-15 8:34 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-14 6:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |9.5
Known to fail| |11.1.0, 4.8.1
Known to work| |4.7.4
Keywords| |TREE
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
2021-11-14 6:30 ` [Bug tree-optimization/103228] " pinskia at gcc dot gnu.org
@ 2021-11-15 8:34 ` pinskia at gcc dot gnu.org
2021-11-15 8:37 ` 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-15 8:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-11-15
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Turns out I had a patch for this bug ran into another bug which just happened
to be fixed on the trunk. So I assigning it to me. I don't know if it will be
accepted for stage 3 or not since I won't be able to submit it today.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
2021-11-14 6:30 ` [Bug tree-optimization/103228] " pinskia at gcc dot gnu.org
2021-11-15 8:34 ` pinskia at gcc dot gnu.org
@ 2021-11-15 8:37 ` pinskia at gcc dot gnu.org
2021-11-15 9:06 ` rguenth 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-15 8:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The patch to fix this is located in PR 60669 comment #2 .
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2021-11-15 8:37 ` pinskia at gcc dot gnu.org
@ 2021-11-15 9:06 ` rguenth at gcc dot gnu.org
2021-11-15 9:07 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-15 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Possibly some STRIP_NOPS gone "missing" during fold-const.c -> match.pd move of
some patterns.
But then reassoc, for bit ops, should eventually learn to look through sign
conversions, re-instantiating them on the leafs and result when required
(maybe optimizing for the number of conversions somehow, or simply prefering
unsigned).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2021-11-15 9:06 ` rguenth at gcc dot gnu.org
@ 2021-11-15 9:07 ` rguenth at gcc dot gnu.org
2021-11-15 9:14 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-15 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2021-11-15 9:07 ` rguenth at gcc dot gnu.org
@ 2021-11-15 9:14 ` pinskia at gcc dot gnu.org
2021-11-16 3:32 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-15 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> Possibly some STRIP_NOPS gone "missing" during fold-const.c -> match.pd move
> of some patterns.
Well match.pd has:
/* Try to fold (type) X op CST -> (type) (X op ((type-x) CST))
when profitable.
For bitwise binary operations apply operand conversions to the
binary operation result instead of to the operands. This allows
to combine successive conversions and bitwise binary operations.
We combine the above two cases by using a conditional convert. */
Just the check for precision was < and not <= :
&& (/* That's a good idea if the conversion widens the operand, thus
after hoisting the conversion the operation will be narrower. */
TYPE_PRECISION (TREE_TYPE (@0)) < TYPE_PRECISION (type)
I am going to test changing < to <=.
Note the atomic changed (PR 103194) might have some conflict with this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2021-11-15 9:14 ` pinskia at gcc dot gnu.org
@ 2021-11-16 3:32 ` cvs-commit at gcc dot gnu.org
2021-11-16 3:33 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-16 3:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
--- Comment #5 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:3200de91bc70bfd6d4b7b40e769bc82756b9b555
commit r12-5291-g3200de91bc70bfd6d4b7b40e769bc82756b9b555
Author: Andrew Pinski <apinski@marvell.com>
Date: Mon Nov 15 22:55:09 2021 +0000
tree-optimization: [PR103245] Improve detection of abs pattern using
multiplication
So while working on PR 103228 (and a few others), I noticed the testcase
for PR 94785
was failing. The problem is that the nop_convert moved from being inside
the IOR to be
outside of it. I also noticed the patch for PR 103228 was not needed to
reproduce the
issue either.
This patch combines the two patterns together for the abs match when using
multiplication
and adds a few places where nop_convert are optional.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103245
gcc/ChangeLog:
* match.pd: Combine the abs pattern matching using multiplication.
Adding optional nop_convert too.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr103245-1.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (6 preceding siblings ...)
2021-11-16 3:32 ` cvs-commit at gcc dot gnu.org
@ 2021-11-16 3:33 ` pinskia at gcc dot gnu.org
2021-11-16 3:36 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-16 3:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Bug 103228 depends on bug 103245, which changed state.
Bug 103245 Summary: Failure to detect abs pattern using multiplication with slightly different casts for unsigned case
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103245
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (7 preceding siblings ...)
2021-11-16 3:33 ` pinskia at gcc dot gnu.org
@ 2021-11-16 3:36 ` pinskia at gcc dot gnu.org
2021-11-17 23:40 ` cvs-commit at gcc dot gnu.org
2021-11-17 23:40 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-16 3:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2021-Novembe
| |r/584551.html
Keywords| |patch
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584551.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (8 preceding siblings ...)
2021-11-16 3:36 ` pinskia at gcc dot gnu.org
@ 2021-11-17 23:40 ` cvs-commit at gcc dot gnu.org
2021-11-17 23:40 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-17 23:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
--- Comment #7 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:32221357007666124409ec3ee0d3a1cf263ebc9e
commit r12-5358-g32221357007666124409ec3ee0d3a1cf263ebc9e
Author: Andrew Pinski <apinski@marvell.com>
Date: Mon Nov 15 09:31:20 2021 +0000
Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST
where type is a nop convert
Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when
the conversion widens
but not when the conversion is a nop. For the same reason why we move the
widening conversion
(the possibility of removing an extra conversion), we should do the same if
the conversion is a
nop.
Committed as approved with the comment change.
PR tree-optimization/103228
PR tree-optimization/55177
gcc/ChangeLog:
* match.pd ((type) X bitop CST): Also do this
transformation for nop conversions.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr103228-1.c: New test.
* gcc.dg/tree-ssa/pr55177-1.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level
2021-11-14 6:30 [Bug tree-optimization/103228] New: [9/10/11/12 Regression] missed optimization with |^ at the gimple level pinskia at gcc dot gnu.org
` (9 preceding siblings ...)
2021-11-17 23:40 ` cvs-commit at gcc dot gnu.org
@ 2021-11-17 23:40 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-17 23:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103228
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|9.5 |12.0
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 12, not worth the backport really.
^ permalink raw reply [flat|nested] 12+ messages in thread