-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Use Core.throw("unreachable") for unreachables instead of ReturnNode()
#115
Conversation
`ReturnNode()` only appears later in the Julia compiler optimization pipeline.
96318f9
to
4d92af1
Compare
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #115 +/- ##
==========================================
+ Coverage 73.41% 73.43% +0.01%
==========================================
Files 16 16
Lines 1486 1487 +1
==========================================
+ Hits 1091 1092 +1
Misses 395 395
☔ View full report in Codecov by Sentry. |
I'm ok with this as a workaround, but if the issue is really with |
I will try to see if there are other blocking points after adding the If the code is truly unreachable, it should be removed in any case by the optimizer. |
JuliaLang/julia#51715 is the fix for |
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.
Co-authored-by: Simeon Schaub <[email protected]>
Tests with #116 are passing, so I will go ahead and merge this. Thanks for the great contribution! The method override warnings on nightly still sound like a potential red herring, so would be good to investigate those at some point as well. |
TFW you thought you just fixed all issues on nightly and then the Windows runner just happens to catch the build one Julia commit further up the line and everything is broken again... 😆 |
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)
It is currently not possible to use
IRTools.unreachable
branches when building irs (see the test which fails with current IRTools).Indeed,
ReturnNode()
only appears later in the Julia compiler optimization pipeline and is not expected to be part of a lowered piece of code. The Julia compiler throws in find_ssavalues_uses and this comment makes me think that it is more supported to throw than to useReturnNode()
in untyped ir.