Skip to content

Commit 7303337

Browse files
committed
Miscellaneous Meta.partially_inline! fixes
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
1 parent 9118ea7 commit 7303337

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

base/meta.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,19 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
362362
x.edges .+= slot_offset
363363
return x
364364
end
365+
if isa(x, Core.UpsilonNode)
366+
if !isdefined(x, :val)
367+
return x
368+
end
369+
return Core.UpsilonNode(
370+
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
371+
slot_offset, statement_offset, boundscheck),
372+
)
373+
end
374+
if isa(x, Core.PhiCNode)
375+
_partially_inline!(x.values, slot_replacements, type_signature, static_param_values,
376+
slot_offset, statement_offset, boundscheck)
377+
end
365378
if isa(x, Core.ReturnNode)
366379
# Unreachable doesn't have val defined
367380
if !isdefined(x, :val)
@@ -381,6 +394,9 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
381394
)
382395
end
383396
if isa(x, Core.EnterNode)
397+
if x.catch_dest == 0
398+
return x
399+
end
384400
return Core.EnterNode(x, x.catch_dest + statement_offset)
385401
end
386402
if isa(x, Expr)

0 commit comments

Comments
 (0)