Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): Fix gate inlining [LNG-253] #924

Merged
merged 4 commits into from
Oct 8, 2023

Conversation

InversionSpaces
Copy link
Contributor

@InversionSpaces InversionSpaces commented Oct 6, 2023

  • Delete ApplyGateRaw as it is actually not used in ValueRaw tree
  • Make inliner for joining n elements of stream not responsible for computing n
  • Refactor ApplyPropertiesInliner
  • Fix unit tests

@linear
Copy link

linear bot commented Oct 6, 2023

LNG-253 Stream gate inlining generates useless code

aqua:

func test(i: i32):
    stream: *string
    stream <<- "a"
    stream <<- "b"
    join stream[i - 1]

bair:

try:
    -relay- <- call %init_peer_id% ("getDataSrv", "-relay-") []
    -i-arg- <- call %init_peer_id% ("getDataSrv", "i") []
    new $stream:
        ap "a" $stream
        ap "b" $stream
        sub <- call %init_peer_id% ("math", "sub") [-i-arg-, 1]
        new $stream_test:
            stream_incr <- call %init_peer_id% ("math", "add") [sub, 1]
            fold $stream stream_fold_var:
                ap stream_fold_var $stream_test
                canon %init_peer_id% $stream_test #stream_iter_canon
                try:
                    match #stream_iter_canon.length stream_incr:
                        null
                catch:
                    next stream_fold_var
            last:
                never
            canon %init_peer_id% $stream_test #stream_result_canon
            ap #stream_result_canon stream_gate
        sub-0 <- call %init_peer_id% ("math", "sub") [-i-arg-, 1]
catch:
    call %init_peer_id% ("errorHandlingSrv", "error") [:error:, 0]

sub-0 - useless second inline of sub

@InversionSpaces InversionSpaces added the e2e Run e2e workflow label Oct 6, 2023
@InversionSpaces InversionSpaces marked this pull request as ready for review October 6, 2023 16:10
@InversionSpaces InversionSpaces merged commit b298eeb into main Oct 8, 2023
@InversionSpaces InversionSpaces deleted the fix/gate-inline-LNG-253 branch October 8, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants