Skip to content

Commit

Permalink
Miscellaneous Meta.partially_inline! fixes
Browse files Browse the repository at this point in the history
I'm not a big fan of this pass, or the way it's written. At a minimum, I'd expect
both better test coverage (when we write similar passes for the core Compiler, we
get away with weak test coverage by relying on user code) and a re-factor to make
this switch exhaustive (it should error if unexpected IR elements are encountered,
instead of just performing an incorrect transformation)

This doesn't make progress on those issues for now, but it at least fixes up a
couple of conspicuous problems I noticed when reviewing #56787
  • Loading branch information
topolarity committed Dec 12, 2024
1 parent 9acf112 commit c0c7415
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions base/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
x.edges .+= slot_offset
return x
end
if isa(x, Core.UpsilonNode)
if !isdefined(x, :val)
return x
end
return Core.UpsilonNode(
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
slot_offset, statement_offset, boundscheck),
)
end
if isa(x, Core.PhiCNode)
_partially_inline!(x.values, slot_replacements, type_signature, static_param_values,
slot_offset, statement_offset, boundscheck)
end
if isa(x, Core.ReturnNode)
return Core.ReturnNode(
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
Expand All @@ -376,6 +389,9 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
)
end
if isa(x, Core.EnterNode)
if x.catch_dest == 0
return x
end
return Core.EnterNode(x, x.catch_dest + statement_offset)
end
if isa(x, Expr)
Expand Down

0 comments on commit c0c7415

Please sign in to comment.