[PATCH] condition branch simplification
Here is the updated version of the patch.
I tried to do as well on the iterator flattening as the old code, but
then realized that the end result will be about as complex as what was
there from before. So instead I wrote a simple pass to stitch the basic
blocks together. It does two things: ff it is an empty block with a
goto, it transfers the outgoing edge directly to the target. And if the
only parent ends with a goto, it combines the block with the parent.
There is also dead code elimination. So I removed the previous entry
point hack for while loops. There is no need for that any more, and the
end result is that we generate very compact basic blocks, often better
than the previous approach did.
The extra pass can almost certainly be reused for other back end passes.
I also did:
- add some lib functions to delete a point from the ptr_list while
iterating.
- Ignore labels which are not used
- some minor bug fixing to the previous patch
Know problem:
- it doesn't deal with phi correctly, I need to redo the phi base
on Tommy's suggestion.