Skip to content

Commit 0aa7b95

Browse files
topolarityKristofferC
authored andcommitted
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. (cherry picked from commit c1db3a4)
1 parent 03ffe4d commit 0aa7b95

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)