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

[Bug] some dead Aleo Instructions code #28504

Open
bendyarm opened this issue Feb 3, 2025 · 0 comments · May be fixed by #28507
Open

[Bug] some dead Aleo Instructions code #28504

bendyarm opened this issue Feb 3, 2025 · 0 comments · May be fixed by #28507
Labels
bug Something isn't working

Comments

@bendyarm
Copy link
Collaborator

bendyarm commented Feb 3, 2025

🐛 Bug Report

Using Leo v2.4.1 (on Leo playground),
this program:

program sample.aleo {
    transition main(public x: field, y: field) -> field {
        if y == 0field {
            return x; 
        } else {
            return x / y;
        }
    }
}

generates the Aleo Instructions code

program sample.aleo;

function main:
    input r0 as field.public;
    input r1 as field.private;
    is.eq r1 0field into r2;
    not r2 into r3;
    div r0 r1 into r4;
    ternary r2 r0 r4 into r5;
    output r5 as field.private;

Note the not r2 into r3 is dead code.

This is new; when I submitted issue#27482
I saw:

function main:
    input r0 as field.public;
    input r1 as field.private;
    is.eq r1 0field into r2;
    div r0 r1 into r3;
    ternary r2 r0 r3 into r4;
    output r4 as field.private;
@bendyarm bendyarm added the bug Something isn't working label Feb 3, 2025
mikebenfield added a commit that referenced this issue Feb 6, 2025
mikebenfield added a commit that referenced this issue Feb 6, 2025
mikebenfield added a commit that referenced this issue Feb 6, 2025
mikebenfield added a commit that referenced this issue Feb 7, 2025
mikebenfield added a commit that referenced this issue Feb 11, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
@mikebenfield mikebenfield linked a pull request Feb 11, 2025 that will close this issue
mikebenfield added a commit that referenced this issue Feb 12, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
mikebenfield added a commit that referenced this issue Feb 12, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
mikebenfield added a commit that referenced this issue Feb 12, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
mikebenfield added a commit that referenced this issue Feb 13, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
mikebenfield added a commit that referenced this issue Feb 18, 2025
Enable DCE by default. Eliminates useless
associated function calls.

Also threw in just a few changes to Display
implementations for some nodes.

Fixes #28504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant