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

Allow using ReturnNode() in @generated code #51715

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

Pangoraw
Copy link
Contributor

IRTools.jl currently tries to use ReturnNode() to model unreachable block terminators but it fails in find_ssavalue_uses. This PR adds a check to enable using ReturnNode() in untyped code.

One other alternative for frontends is to use an instruction known to terminate (Core.throw) instead. See FluxML/IRTools.jl#115 for more context.

Copy link
Member

@Keno Keno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, why not.

@Keno Keno merged commit ff03e51 into JuliaLang:master Oct 16, 2023
2 of 6 checks passed
@Pangoraw Pangoraw deleted the untyped_unreachable branch October 16, 2023 05:30
@simeonschaub simeonschaub added backport 1.9 Change should be backported to release-1.9 backport 1.10 Change should be backported to the 1.10 release labels Oct 16, 2023
simeonschaub added a commit to FluxML/IRTools.jl that referenced this pull request Oct 16, 2023
…115)

* Use Core.throw("unreachable") for unreachables

`ReturnNode()` only appears later in the Julia compiler optimization pipeline.

* Use returnode() when possible

* Update src/ir/wrap.jl

Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>

---------

Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
KristofferC pushed a commit that referenced this pull request Oct 23, 2023
IRTools.jl currently tries to use `ReturnNode()` to model unreachable
block terminators but it fails in `find_ssavalue_uses`. This PR adds a
check to enable using `ReturnNode()` in untyped code.

One other alternative for frontends is to use an instruction known to
terminate (`Core.throw`) instead. See
FluxML/IRTools.jl#115 for more context.

(cherry picked from commit ff03e51)
@KristofferC KristofferC removed the backport 1.10 Change should be backported to the 1.10 release label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.9 Change should be backported to release-1.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants