Skip to content

Commit c1db3a4

Browse files
authored
Miscellaneous Meta.partially_inline! fixes (#56813)
This fixes up a couple of conspicuous problems I noticed when reviewing #56787 I'm unsure we should have accepted this pass in Base to begin with... It should at least be re-written to error on unexpected IR elements (instead of performing an invalid transform silently), but the real problem is that this pass is out-of-pipeline and so it doesn't run on most user code and we have much worse coverage compared to passes in the main Compiler.
1 parent db8cc48 commit c1db3a4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

base/meta.jl

+16
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,19 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
364364
x.edges .+= slot_offset
365365
return x
366366
end
367+
if isa(x, Core.UpsilonNode)
368+
if !isdefined(x, :val)
369+
return x
370+
end
371+
return Core.UpsilonNode(
372+
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
373+
slot_offset, statement_offset, boundscheck),
374+
)
375+
end
376+
if isa(x, Core.PhiCNode)
377+
_partially_inline!(x.values, slot_replacements, type_signature, static_param_values,
378+
slot_offset, statement_offset, boundscheck)
379+
end
367380
if isa(x, Core.ReturnNode)
368381
# Unreachable doesn't have val defined
369382
if !isdefined(x, :val)
@@ -383,6 +396,9 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
383396
)
384397
end
385398
if isa(x, Core.EnterNode)
399+
if x.catch_dest == 0
400+
return x
401+
end
386402
return Core.EnterNode(x, x.catch_dest + statement_offset)
387403
end
388404
if isa(x, Expr)

0 commit comments

Comments
 (0)