On 07/28/2010 12:18 AM, Eric Botcazou wrote:
That's a non-argument, and false IMO. Not every optimization can be
represented cleanly as a set of CFG manipulations, and this one can't.
I wrote "this kind of transformations", not "all transformations".
What about the algorithm sketched by Paolo?
Paolo's "algorithm" was
- split the destination BB before the jump (into BB11 and BB12)
- split the source BBs after the last moved instruction (into BB21 and
BB22, BB31 and BB32, etc.)
- redirect the jumps to BBn1 (n>=2) to go to BBn2.
- graft BB21 between BB11 and BB12, remove all BBn1 for n>2
which has exactly the effect of one call to reorder_insns and a few more
to delete_insn, except it creates lots of garbage BBs only to delete
them immediately again.
What exactly is gained by that? Certainly not readability. You're
moving insns, so reorder_insns is the correct API. The suggestion is
obviously absurd in my eyes.