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

Disallow calls on the RHS of a :(=) expr in lowered IR #33286

Open
Keno opened this issue Sep 16, 2019 · 1 comment
Open

Disallow calls on the RHS of a :(=) expr in lowered IR #33286

Keno opened this issue Sep 16, 2019 · 1 comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@Keno
Copy link
Member

Keno commented Sep 16, 2019

Since lowered IR is not often consumed by Cassette-like tools for code transformation, I think it could use a bit of clean up. One thing that has bothered me for a bit is code that looks like the following.

stmt = expr = stmts[i]
if isexpr(stmt, :(=))
    expr = stmt.args[2]
end

# Do something with expr
expr = Expr(:call, :something_fun, expr.args[2:end]...)

if isexpr(stmt, :(=))
   stmt.args[2] = expr
end

I think it would make sense to only allow SSAValues on the RHS of an :(=) Expr in lowered IR, so code that e.g. only wants to rewrite all the calls in a function can simply ignore them.

@Keno Keno added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Sep 16, 2019
@JeffBezanson
Copy link
Sponsor Member

This would be nice. I think we probably tried it at one point, and it made the IR significantly larger, which is not surprising. With a more compact encoding it might be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

2 participants