public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N]
@ 2012-02-15 0:21 pinskia at gcc dot gnu.org
2012-02-15 0:23 ` [Bug tree-optimization/52254] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-15 0:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254
Bug #: 52254
Summary: VRP does not fold (~a) & N to a ^ N if a has range [0,
N]
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pinskia@gcc.gnu.org
While working on moving fold-const.c bit expression optimizations to a SSA
based optimization, I found that if we optimize (a^N)&N to ~a & N, VRP does not
change that to just a ^ N.
Simple example:
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-vrp1" } */
int f(int x)
{
if (x >= 0 && x <= 3)
{
x = (x ^ 3) & 3;
}
return x;
}
/* { dg-final { scan-tree-dump-times " & 3;" 0 "vrp1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52254] VRP does not fold (~a) & N to a ^ N if a has range [0, N]
2012-02-15 0:21 [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N] pinskia at gcc dot gnu.org
@ 2012-02-15 0:23 ` pinskia at gcc dot gnu.org
2012-02-15 11:25 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-15 0:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-02-15
AssignedTo|unassigned at gcc dot |pinskia at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-15 00:23:42 UTC ---
I am going to work on this with my combine patches, I am thinking about
allowing VRP to supply a range to the combine stage and we should be able to
use that info to do the folding there (in a more common place too).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52254] VRP does not fold (~a) & N to a ^ N if a has range [0, N]
2012-02-15 0:21 [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N] pinskia at gcc dot gnu.org
2012-02-15 0:23 ` [Bug tree-optimization/52254] " pinskia at gcc dot gnu.org
@ 2012-02-15 11:25 ` rguenth at gcc dot gnu.org
2012-02-16 3:05 ` pinskia at gcc dot gnu.org
2021-06-03 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-15 11:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-15 11:21:53 UTC ---
The combine stage should have access to a valueize() hook as well, to query
SSA propagator/VNs lattice. That hook can maybe supply this extra info
(I wanted to make VRP info persistent for some time, in SSA_NAME_PTR_INFO
much like we have alignment info there which really is kind of a value-range)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52254] VRP does not fold (~a) & N to a ^ N if a has range [0, N]
2012-02-15 0:21 [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N] pinskia at gcc dot gnu.org
2012-02-15 0:23 ` [Bug tree-optimization/52254] " pinskia at gcc dot gnu.org
2012-02-15 11:25 ` rguenth at gcc dot gnu.org
@ 2012-02-16 3:05 ` pinskia at gcc dot gnu.org
2021-06-03 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-16 3:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-16 03:00:22 UTC ---
(In reply to comment #2)
> The combine stage should have access to a valueize() hook as well, to query
> SSA propagator/VNs lattice. That hook can maybe supply this extra info
> (I wanted to make VRP info persistent for some time, in SSA_NAME_PTR_INFO
> much like we have alignment info there which really is kind of a value-range)
I was thinking about adding that. Even using nonzero bits to create a simple
range.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52254] VRP does not fold (~a) & N to a ^ N if a has range [0, N]
2012-02-15 0:21 [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N] pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2012-02-16 3:05 ` pinskia at gcc dot gnu.org
@ 2021-06-03 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-03 0:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|--- |7.0
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Was fixed with r7-820 which adds the pattern to match.pd.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-03 0:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 0:21 [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N] pinskia at gcc dot gnu.org
2012-02-15 0:23 ` [Bug tree-optimization/52254] " pinskia at gcc dot gnu.org
2012-02-15 11:25 ` rguenth at gcc dot gnu.org
2012-02-16 3:05 ` pinskia at gcc dot gnu.org
2021-06-03 0:40 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).