[PATCH] PR rtl-optimization/53352

Meador Inge meadori@codesourcery.com
Thu May 17 20:46:00 GMT 2012


On 05/17/2012 03:02 PM, Richard Sandiford wrote:

> After agonising over this for a couple of days, I think it's probably
> the correct fix.  What we're doing now would be valid if the only use of
> equiv_constant(x) were to substitute for x.  The name and current use
> of the function obviously require equality though.
> 
> Patch is OK, thanks.  It might be worth extending fold_rtx and
> equiv_constant to set a flag that says whether the returned value
> is equivalent or simply one of many valid replacement values.
> We'd then be able to replace uses of registers like 142 with 0,
> while not replacing uses of 0 with 142.  I don't know how much it
> would buy us though.  That kind of thing is probably more of a job
> for fwprop.

Thanks for the review.

> Please add UL to the hex constants in the testcase.  Not sure whether
> it matters for 16-bit int targets or not, but better safe than sorry :-)

Fixed.

> Also, rather than:
> 
>> +      /* Otherwise see if we already have a constant for the inner REG.
>> +	 Don't bother with paradoxical subregs because we have no way
>> +	 of knowing what the upper bytes are.  */
> 
> how about:
> 
>       /* Otherwise see if we already have a constant for the inner REG,
> 	 and if that is enough to calculate an equivalent constant for
> 	 the subreg.  Note that the upper bits of paradoxical subregs
> 	 are undefined, so they cannot be said to equal anything.  */

Sounds good to me.

v2 OK?  If so, would you mind committing for me?  I don't have write access.


-- 
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr53352-v2.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120517/5735ef20/attachment.bin>


More information about the Gcc-patches mailing list