[Mono-bugs] [Bug 379822] GMCS optimizes "var && false" to "var" instead of "false"

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 15 13:52:28 EDT 2008


User jan.oravec at 6com.sk added comment

--- Comment #4 from Jan Oravec <jan.oravec at 6com.sk>  2008-04-15 11:52:28 MST ---
Sorry if the following is obvious, planned or already implemented some other
way (this is about second or third time I look at MCS sources):

I think that it would benefit if there was something like EmitNoResult(), which
would default to Emit() followed by pop. The idea behind this is that the if()
condition logic could be replaced by right.EmitNoResult(). Constants could
simply emit nothing in this case.

This could be later used for more optimizations to not calculate unneeded
results and just do side effect stuff - e.g. something like
complicated_expression && false would not compute that expression at all, if
there are no side effects in the expression itself.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list