On 12/22/09 11:16, Andrew Hutchinson wrote:
I came across this RTL on AVR in combine dump (part of va-arg-9.c test)
(set (reg:QI 25 r25 [+1 ])
(subreg:QI (sign_extend:HI (reg:QI 49)) 1))
The sign extension is completely redundant - the upper part of
register is not used elsewhere
- but the RTL remains unchanged through all the optimizers and
sign_extension appears in final code.
Which RTL optimisation should be taking care of this? Propagation?
It would help me look in the right place to understand and perhaps fix
issue.
I suspect the presence of hard register is why it does not get
removed. (the hard register is the function return value)
I'd look at combine, though I think it's more concerned with determining
that an extension is redundant because the bits already have the proper
value rather than the bits not being used later. It might be the case
that you can extend what's already in combine to do what you want.
jeff