On 10/25/2010 10:46 AM, Frederic Riss wrote:
Hi,

The constant propagation pass propagates constants into the
instructions that accept immediates. I'm trying to find if there's
some CSE pass in GCC that would be able to undo this effect when the
constant is used more than once in the function. I looked at the CSE
code (4.5 branch) and I don't think this is currently possible. If the
code uses a bunch of big constants, the effect on code size might be
quite sensible.

I hacked around that in a quite horrible manner: I arranged for the
immediate alternative of some insn patterns to be invalid during the
'cprop' passes. That way cprop doesn't put the immediate into the
instructions, but if the constant is used only once it will be
propagated into the instruction by the 'combine' pass. This seems
excessively hackish to me, I wanted to know if there's some
better/standard way to handle that issue.

You need to teach constant propagation to look at insn costs, like fwprop does.

Alternatively, try rearranging passes (e.g. swapping GCSE and fwprop) so that you can delete the local copy propagation completely. :)

Paolo

Reply via email to