Patch: don't generate dead bytecode
Per Bothner
per@bothner.com
Tue Oct 9 12:24:00 GMT 2001
Tom Tromey wrote:
>Today I ran `make class-check' on libgcj. One of the problems is a
>bug in the front end (previously reported). All the other problems
>turned out to be dead byte code which was generated. It turns out we
>generate code for a statement like this:
>
> if (false) { do something }
>
>This patch removes all that dead bytecode. It does so by simply not
>generating code along a dead branch.
>
Wouldn't it be a lot simpler and cleaner to optimize this at the tree level,
sort of like constant folding? For example in patch_if_else_statement.
One possible complication is that CAN_COMPLETE_NORMALLY
needs to be set on the resulting node even if only the optimized-away
branch can complete normally. I'll try a patch that does this.
More information about the Gcc-patches
mailing list