Hi Jeff,

On 26 October 2010 16:22, Jeff Law <l...@redhat.com> wrote:
> There is currently no pass which does "un-cse"; however, using insn
> splitting and operand costing and suitable insn constraints/predicates  you
> can usually arrange to avoid expensive constants in places where it makes
> sense.

The thing is the cprop pass doesn't look at insn costs while doing its
job AFAICS. I'm interested to see how insn splitting can help with
this if you don't care to explain.

> Perhaps if you gave us more information about the target and the situations
> you're trying to avoid we could give more specific advice.

The problem is quite simple: if a target allows big immediates in its
instructions, the cprop pass can generate quite an inflation in code
size on some kind of codes. Imagine that a 64-bits constant is
propagated in every iteration of an unrolled loop. For that case, it
would be much more cache friendly to have the constant in register(s)
and not propagate it. Do not focus too much on the 'loop unrolling'
thing, it's just an example of one kind of code that uses the same
constant a bunch of times.

The tradeoff is hard to decide. If you manage to factorize the
constants so that they're hold in registers, then you might
significantly increase the register pressure especially if they are
used at distant points of the function... and thus degrade the
performance. The thing is, I don't see any knob to tweak that trade
off, hence my question. As I mentioned, I managed to achieve part of
what I wanted by making the big immediates variants illegal during the
cprop pass, but that seems like too much of a hack.

Thanks!
Fred

Reply via email to