luau-lang/luau

[COMPILER OPTIMIZATION] Simplify Conditional Logic Expressions

Opened this issue · 0 comments

Compiler should optimize

do
    return value == "" and value
end

into

do
    return value == "" and ""
end

With locals the difference gap gets smaller for each optimize level until it's barely noticeable.
With globals (GETGLOBAL|GETIMPORT) the difference stays noticeable on all optimize levels.

Likewise for the if-then-else expressions and any other conditional logic expressions

There's also a chance that similar logic can be applied to other places in code.