Open Woccz opened 3 years ago
Does this happen "by accident" during compilation, or does the programmer need to deliberatly place a goto
The compiled code has not been changed. What is your question exactly?
I just wondered if the compiler would generate such inefficient code when using if and while blocks, or if this only happens if the user is doing it himself.
At least for label-gotos this should be relatively simple to detect and remove. There is already code to remove useless gotos, which could just be extended to handle this.
Well it's smart enough to replace the goto a > goto b with just a goto b, just missed the goto next line(after empty lines removed).
Given the following code:
in NOLOL, it compiles to:
There is no need for a goto pointing to the next line.
I suggest during optimisation to search and remove all
goto
s that point to the next line.Thank you.