Skip to content

Commit a65d8b4

Browse files
committed
Extract PiNode insertion code from #26969
This is just the pinode insertion code from #26969, which together with #27068, should hopefully cover the same benchmarks in a more acceptable way.
1 parent 3b5e180 commit a65d8b4

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

base/compiler/ssair/inlining2.jl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,22 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, topmod::Module, idx:
379379
insert_node_here!(compact, GotoIfNot(cond, next_cond_bb), Union{}, line)
380380
bb = next_cond_bb - 1
381381
finish_current_bb!(compact)
382-
# Insert Pi nodes here
382+
argexprs′ = argexprs
383+
if !isa(case, ConstantCase)
384+
argexprs′ = copy(argexprs)
385+
for i = 2:length(metharg.parameters)
386+
a, m = atype.parameters[i], metharg.parameters[i]
387+
isa(argexprs[i], SSAValue) || continue
388+
if !(a <: m)
389+
argexprs′[i] = insert_node_here!(compact, PiNode(argexprs′[i], m),
390+
m, line)
391+
end
392+
end
393+
end
383394
if isa(case, InliningTodo)
384-
val = ir_inline_item!(compact, idx, argexprs, linetable, case, boundscheck, todo_bbs)
395+
val = ir_inline_item!(compact, idx, argexprs, linetable, case, boundscheck, todo_bbs)
385396
elseif isa(case, MethodInstance)
386-
val = insert_node_here!(compact, Expr(:invoke, case, argexprs...), typ, line)
397+
val = insert_node_here!(compact, Expr(:invoke, case, argexprs...), typ, line)
387398
else
388399
case = case::ConstantCase
389400
val = case.val

0 commit comments

Comments
 (0)