[PATCH] Handle CONST in a few more places in simplify-rtx.c

Jakub Jelinek jakub@redhat.com
Sun Sep 13 20:08:00 GMT 2009


On Sun, Sep 13, 2009 at 08:54:24PM +0100, Richard Sandiford wrote:
> This is probably a dumb question, sorry, but why do you need to
> strip the CONSTs?  I realise you're at least partly doing it for
> consistency with simplify_unary_operation, but I notice that that
> function strips the CONST from the original operand ("op")
> _before_ calling avoid_constant_pool_reference.  Here you instead
> strip the CONST from the "trueopX" variable _after_ calling
> avoid_constant_pool_reference.  Is that a deliberate difference?
> 
> >From a quick scan, all uses of trueop{0,1} in simplify_binary_operation_1
> and simplify_const_binary_operation appear to be of the form
> "rtx_equal_p (trueop0, trueop1)" or "GET_CODE (trueopX) == CONST_FOO".
> Stripping CONSTs shouldn't affect those, because it's invalid to have
> (const (const_int ...)), (const (const_vector ...)), etc.

I guess the earlier can be explained by saying that both cselib and
DEBUG_INSNs use (const:mode (const_int ...)) and (const:mode (const_double ...))
(see wrap_constant) and my patch is just to make sure the extra const isn't
blocking optimization of it.

	Jakub



More information about the Gcc-patches mailing list