Conversation
|
I have no problem with this for now; DCE is simple and cheap. I do think it would be an interesting exercise to try to avoid generating the structurally-unreachable code in the first place without relying on powerful IR. I have a feeling it might not be too bad and would likely be worth doing, and would also avoid the need for an O0 which produces invalid code (and in the event that we decide that it is valid, we can just back this change out anyway). |
|
Yeah, the rule seems to be "disallow code until the end of a block, once you see a |
|
The other option, if we really do want to have all the code in the binary for debugging, would just be to wrap the br in a block by itself. |
|
Oh right, yeah, we could work around it that way too. Simple option too, if we need it. Landing as there are no concerns and I'm already getting reports of code failing due to this. |
This is forced upon us as Firefox is landing a patch that rejects unreachable code. I don't fully understand what's going on in the spec process about this, but seems like binaryen and other producers have no other options but to not emit unreachable code.
This has some downsides, as discussed in #862, namely it makes -O0 a tiny bit slower. It also means -O0 now optimizes, so it might make debugging harder (and perhaps we'll need an "-O0 without DCE" mode at some point). So depending on the spec process perhaps we'll end up reverting it.