This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N]
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Feb 2012 00:21:43 +0000
- Subject: [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N]
- Auto-submitted: auto-generated
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" } } */