[Bug middle-end/52134] Does not fold (x * 4) & -4
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Wed Mar 14 09:40:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52134
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> 2012-03-14 09:39:31 UTC ---
On Tue, 13 Mar 2012, pinskia at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52134
>
> --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-13 22:08:12 UTC ---
> CCP could also remove the &:
> Visiting statement:
> D.1713_2 = t_1(D) * 4;
> which is likely CONSTANT
> Lattice value changed to CONSTANT Lattice value changed to CONSTANT
> 0x00000000000000000 (0x000000000fffffffc). Adding SSA edges to worklist.
>
> Visiting statement:
> D.1712_3 = D.1713_2 & 4294967292;
> which is likely CONSTANT
> Lattice value changed to CONSTANT Lattice value changed to CONSTANT
> 0x00000000000000000 (0x000000000fffffffc). Adding SSA edges to worklist.
>
> ..
> Visiting statement:
> D.1710_2 = t_1(D) * 4;
> which is likely CONSTANT
> Lattice value changed to CONSTANT Lattice value changed to CONSTANT
> 0x00000000000000000 (0xfffffffffffffffffffffffffffffffc). Adding SSA edges to
> worklist.
>
> Visiting statement:
> D.1709_3 = D.1710_2 & -4;
> which is likely CONSTANT
> Lattice value changed to CONSTANT Lattice value changed to CONSTANT
> 0x00000000000000000 (0xfffffffffffffffffffffffffffffffc). Adding SSA edges to
> worklist.
>
>
> See how the lattice's already have its last 3 bits unset. In fact I think we
> should only do this in the ccp/vrp passes to remove the & rather than fold.
Yeah, CCP and VRP can do this as well. In fact folding bit-operations
with the bit-CCP lattice is an obvious improvement, best done in
ccp_fold_stmt which is called at lattice substitution time.
Richard.
More information about the Gcc-bugs
mailing list