@@ -25,18 +25,18 @@ function extract_inner_call!(stmt::Expr, idx, once::Bool=false)
25
25
return nothing
26
26
end
27
27
28
- function replace_ssa! (@nospecialize (stmt), ssalookup)
29
- isa (stmt, Expr) || return nothing
30
- for (i, a) in enumerate ( stmt. args)
28
+ function replace_ssa (@nospecialize (stmt), ssalookup)
29
+ isa (stmt, Expr) || return stmt
30
+ return Expr ( stmt. head, Any[
31
31
if isa (a, SSAValue)
32
- stmt . args[i] = SSAValue (ssalookup[a. id])
32
+ SSAValue (ssalookup[a. id])
33
33
elseif isa (a, NewSSAValue)
34
- stmt . args[i] = SSAValue (a. id)
34
+ SSAValue (a. id)
35
35
else
36
- replace_ssa! (a, ssalookup)
36
+ replace_ssa (a, ssalookup)
37
37
end
38
- end
39
- return nothing
38
+ for a in stmt . args
39
+ ] . .. )
40
40
end
41
41
42
42
function renumber_ssa! (stmts:: Vector{Any} , ssalookup)
@@ -54,10 +54,11 @@ function renumber_ssa!(stmts::Vector{Any}, ssalookup)
54
54
elseif isa (stmt, NewSSAValue)
55
55
stmts[i] = SSAValue (stmt. id)
56
56
elseif isa (stmt, Expr)
57
- replace_ssa! (stmt, ssalookup)
57
+ stmt = replace_ssa (stmt, ssalookup)
58
58
if (stmt. head === :gotoifnot || stmt. head === :enter ) && isa (stmt. args[end ], Int)
59
59
stmt. args[end ] = jumplookup (ssalookup, stmt. args[end ])
60
60
end
61
+ stmts[i] = stmt
61
62
elseif is_GotoIfNot (stmt)
62
63
cond = (stmt:: Core.GotoIfNot ). cond
63
64
if isa (cond, SSAValue)
@@ -287,7 +288,7 @@ function build_compiled_call!(stmt::Expr, fcall, code, idx, nargs::Int, sparams:
287
288
push! (args, cconvert_expr. args[3 ])
288
289
elseif arg isa SlotNumber
289
290
index = findfirst (code. code) do expr
290
- expr isa Expr || return false
291
+ Meta . isexpr ( expr, :( = )) || return false
291
292
lhs = expr. args[1 ]
292
293
return lhs isa SlotNumber && lhs. id === arg. id
293
294
end
0 commit comments