Post by Zdenek Dvorak Post by Richard Henderson Post by Joern Rennecke
Since May 2000, optimize_mode_switching has some code to pretend that
the exit block is an ordinary block when NORMAL_MODE is defined.
This does not mix with the new FOR_EACH_BB / FOR_EACH_BB_REVERSE macros.
We can either restore lcm to the state where it doesn't fiddle with the
basic block array, or make the FOR_EACH_BB* macros cope with that.
The included patch implements the latter.
I'd really prefer the former, if it can be managed without
merely exchanging one form of ugliness for another.
Well, I don't think that is possible. The way it was before it stuck a switch
to NORMAL_MODE in each predecessor of the exit block that didn't already compute
NORMAL_MODE. The place where to stick that switch is not trivial, since the
basic block might end with a JUMP_INSN and some USEs; in that case, we have to
skip back to the JUMP_INSN and pretend that it is that insn that wants
It's also not accurate in that the need only applies to the edge that goes to
the exit block.
Now that I look at the code once more, I see that we have an analogous problem
for the entry block, and it isn't properly solved: when there are other
to an entry block successor than the entry block itself, we can incorrectly
that the entry block sucessor has NORMAL_MODE at the start, even if it hasn't.
Post by Zdenek Dvorak
I really do not see into what lcm.c does; but would not creating some
sort of fake block at the end of chain and removing it later work?
Yes, it would; however, you'd have to allocate that fake block, copy the exit
block to it, redirect all the predecessors of the exit block to that fake
block, and make an edge betwen the fake block and the exit block.
At the end, you'd have to remove the edge between exit block and fake block,
redirect the fake block predecessors back to the exit block, and deallocate.
It would be easier if we just redefine EXIT_BLOCK_PTR and ENTRY_BLOCK_PTR in
to be global pointer variables - initialized to entry_exit_block[], and set
them to new values in the NORMAL_MODE case.
2430 Aztec West / Almondsbury / BRISTOL / BS32 4AQ
T:+44 1454 462330