Skip to content

Commit a4cd62b

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 48be7ca commit a4cd62b

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
return Core.ReturnNode(
367380
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
@@ -376,6 +389,9 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
376389
)
377390
end
378391
if isa(x, Core.EnterNode)
392+
if x.catch_dest == 0
393+
return x
394+
end
379395
return Core.EnterNode(x, x.catch_dest + statement_offset)
380396
end
381397
if isa(x, Expr)

0 commit comments

Comments
 (0)