[WIP] Eliminate branch when the condition is false#3133
[WIP] Eliminate branch when the condition is false#3133baziotis wants to merge 1 commit intoldc-developers:masterfrom baziotis:if_false
Conversation
|
Some comments:
|
|
Also: try and find out how DMD, GDC, (and Clang) tackle this problem. |
Great thanks! I think it's better to close this PR and open a new more specific one. I'll ask on slack if we have any info for labels and how difficult would be for me to add it. Edit: Btw now that I'm thinking of that, getting a list of all the labels in a function is not enough. There has to be some location info about each label and I'm not yet sure what this info can look like. Or even if the labels per se are the point of interest here. |
I believe this is a very good advice. Unfortunately, and these are only things I've heard not that I have worked with any of the two: the DMD back-end is one of the most obscure (i.e. pretty much only Walter understands it). The GDC front-end too (i.e. only Iain understands it). I'll have a look at them, but I dare to say that maybe the most approachable is Clang. |
|
Continues here: #3134 |
Partially solving (i.e. only false conditions): #2344
It does not work! You can even see that 2 test cases I added fail. Now that I saw the issue again, I should add a test case for labels.
I'm uploading just for opinions. Essentially the problems are:
false_cond_with_else.dshould be easy to pass. Fortunately, the front-end breaks anelse if (cond)toelse { if (cond) }so if there is an else body, that should be handled.