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

Handle PhiNode with edge==0 #46388

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Handle PhiNode with edge==0 #46388

merged 1 commit into from
Aug 18, 2022

Conversation

martinholters
Copy link
Member

I'm not entirely sure this makes sense. Maybe we shouldn't produce PhiNodes with an edge of 0 in the first place (inserting a dummy instruction as first BB before it instead or something). But I do get the same @code_llvm for f() = while true x = try finally end end and g() = (nothing; while true x = try finally end end), where before, inference of f() would give an internal error. Also, I note that once upon a time, we used to do something similar:

if isa(val, PhiNode)
# Translate from BB edges to statement edges
edges = Any[edge == 0 ? 0 : terminator_mapping[edge] for edge in val.edges]
@assert all(x->x >= 0, edges)
val = PhiNode(convert(Vector{Any}, edges), copy(val.values))

I'm not sure a 0-edge might cause trouble elsewhere, though. But then again, it would not have worked at all before and did not seem to cause too much trouble, so those PhiNodes seem to be quite rare, and at least the case at hand is fixed by this.

Fixes #45600.

@martinholters martinholters added bugfix This change fixes an existing bug compiler:inference Type inference backport 1.6 Change should be backported to release-1.6 backport 1.8 Change should be backported to release-1.8 labels Aug 18, 2022
@martinholters martinholters requested a review from Keno August 18, 2022 09:42
@Keno Keno merged commit fd66c30 into master Aug 18, 2022
@Keno Keno deleted the mh/fix-45600 branch August 18, 2022 19:24
KristofferC pushed a commit that referenced this pull request Aug 26, 2022
(cherry picked from commit fd66c30)
KristofferC pushed a commit that referenced this pull request Aug 26, 2022
(cherry picked from commit fd66c30)
@giordano giordano linked an issue Aug 26, 2022 that may be closed by this pull request
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Sep 7, 2022
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit fd66c30)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit fd66c30)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
(cherry picked from commit fd66c30)
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
(cherry picked from commit fd66c30)
KristofferC pushed a commit that referenced this pull request Oct 10, 2023
(cherry picked from commit fd66c30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.6 Change should be backported to release-1.6 bugfix This change fixes an existing bug compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Julia 1.8 crashes with @time macro @time in global while loop causes internal error
3 participants