@@ -135,7 +135,7 @@ function cfg_inline_item!(ir::IRCode, idx::Int, todo::InliningTodo, state::CFGIn
135
135
last_block_idx = last (state. cfg. blocks[block]. stmts)
136
136
if false # TODO : ((idx+1) == last_block_idx && isa(ir[SSAValue(last_block_idx)], GotoNode))
137
137
need_split = false
138
- post_bb_id = - ir[SSAValue (last_block_idx)][:inst ]. label
138
+ post_bb_id = - ir[SSAValue (last_block_idx)][:stmt ]. label
139
139
else
140
140
post_bb_id = length (state. new_cfg_blocks) + length (inlinee_cfg. blocks) + (need_split_before ? 1 : 0 )
141
141
need_split = true # !(idx == last_block_idx)
@@ -196,7 +196,7 @@ function cfg_inline_item!(ir::IRCode, idx::Int, todo::InliningTodo, state::CFGIn
196
196
for (old_block, new_block) in enumerate (bb_rename_range)
197
197
if (length (state. new_cfg_blocks[new_block]. succs) == 0 )
198
198
terminator_idx = last (inlinee_cfg. blocks[old_block]. stmts)
199
- terminator = todo. ir[SSAValue (terminator_idx)][:inst ]
199
+ terminator = todo. ir[SSAValue (terminator_idx)][:stmt ]
200
200
if isa (terminator, ReturnNode) && isdefined (terminator, :val )
201
201
any_edges = true
202
202
push! (state. new_cfg_blocks[new_block]. succs, post_bb_id)
@@ -556,7 +556,7 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int, argexprs::
556
556
union_split:: UnionSplit , boundscheck:: Symbol ,
557
557
todo_bbs:: Vector{Tuple{Int,Int}} , params:: OptimizationParams )
558
558
(; fully_covered, atype, cases, bbs) = union_split
559
- stmt, typ, line = compact. result[idx][:inst ], compact. result[idx][:type ], compact. result[idx][:line ]
559
+ stmt, typ, line = compact. result[idx][:stmt ], compact. result[idx][:type ], compact. result[idx][:line ]
560
560
join_bb = bbs[end ]
561
561
pn = PhiNode ()
562
562
local bb = compact. active_result_bb
@@ -605,9 +605,9 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int, argexprs::
605
605
if isa (case, InliningTodo)
606
606
val = ir_inline_item! (compact, idx, argexprs′, case, boundscheck, todo_bbs)
607
607
elseif isa (case, InvokeCase)
608
- inst = Expr (:invoke , case. invoke, argexprs′... )
608
+ invoke_stmt = Expr (:invoke , case. invoke, argexprs′... )
609
609
flag = flags_for_effects (case. effects)
610
- val = insert_node_here! (compact, NewInstruction (inst , typ, case. info, line, flag))
610
+ val = insert_node_here! (compact, NewInstruction (invoke_stmt , typ, case. info, line, flag))
611
611
else
612
612
case = case:: ConstantCase
613
613
val = case. val
@@ -993,7 +993,7 @@ function handle_single_case!(todo::Vector{Pair{Int,Any}},
993
993
ir:: IRCode , idx:: Int , stmt:: Expr , @nospecialize (case),
994
994
isinvoke:: Bool = false )
995
995
if isa (case, ConstantCase)
996
- ir[SSAValue (idx)][:inst ] = case. val
996
+ ir[SSAValue (idx)][:stmt ] = case. val
997
997
elseif isa (case, InvokeCase)
998
998
is_foldable_nothrow (case. effects) && inline_const_if_inlineable! (ir[SSAValue (idx)]) && return nothing
999
999
isinvoke && rewrite_invoke_exprargs! (stmt)
@@ -1120,7 +1120,7 @@ function inline_apply!(todo::Vector{Pair{Int,Any}},
1120
1120
break
1121
1121
end
1122
1122
if nonempty_idx != 0
1123
- ir. stmts[ idx][:inst ] = stmt. args[nonempty_idx]
1123
+ ir[ SSAValue ( idx) ][:stmt ] = stmt. args[nonempty_idx]
1124
1124
return nothing
1125
1125
end
1126
1126
end
@@ -1236,8 +1236,9 @@ end
1236
1236
# this method does not access the method table or otherwise process generic
1237
1237
# functions.
1238
1238
function process_simple! (todo:: Vector{Pair{Int,Any}} , ir:: IRCode , idx:: Int , state:: InliningState )
1239
- stmt = ir. stmts[idx][:inst ]
1240
- rt = ir. stmts[idx][:type ]
1239
+ inst = ir[SSAValue (idx)]
1240
+ stmt = inst[:stmt ]
1241
+ rt = inst[:type ]
1241
1242
if ! (stmt isa Expr)
1242
1243
check_effect_free! (ir, idx, stmt, rt, state)
1243
1244
return nothing
@@ -1247,7 +1248,7 @@ function process_simple!(todo::Vector{Pair{Int,Any}}, ir::IRCode, idx::Int, stat
1247
1248
if head === :splatnew
1248
1249
inline_splatnew! (ir, idx, stmt, rt, state)
1249
1250
elseif head === :new_opaque_closure
1250
- narrow_opaque_closure! (ir, stmt, ir . stmts[idx] [:info ], state)
1251
+ narrow_opaque_closure! (ir, stmt, inst [:info ], state)
1251
1252
elseif head === :invoke
1252
1253
sig = call_sig (ir, stmt)
1253
1254
sig === nothing && return nothing
@@ -1267,14 +1268,14 @@ function process_simple!(todo::Vector{Pair{Int,Any}}, ir::IRCode, idx::Int, stat
1267
1268
# Check if we match any of the early inliners
1268
1269
earlyres = early_inline_special_case (ir, stmt, rt, sig, state)
1269
1270
if isa (earlyres, SomeCase)
1270
- ir . stmts[idx][ :inst ] = earlyres. val
1271
+ inst[ :stmt ] = earlyres. val
1271
1272
return nothing
1272
1273
end
1273
1274
1274
1275
if check_effect_free! (ir, idx, stmt, rt, state)
1275
1276
if sig. f === typeassert || ⊑ (optimizer_lattice (state. interp), sig. ft, typeof (typeassert))
1276
1277
# typeassert is a no-op if effect free
1277
- ir . stmts[idx][ :inst ] = stmt. args[2 ]
1278
+ inst[ :stmt ] = stmt. args[2 ]
1278
1279
return nothing
1279
1280
end
1280
1281
end
@@ -1288,7 +1289,7 @@ function process_simple!(todo::Vector{Pair{Int,Any}}, ir::IRCode, idx::Int, stat
1288
1289
# Special case inliners for regular functions
1289
1290
lateres = late_inline_special_case! (ir, idx, stmt, rt, sig, state)
1290
1291
if isa (lateres, SomeCase)
1291
- ir[ SSAValue (idx)][ :inst ] = lateres. val
1292
+ inst[ :stmt ] = lateres. val
1292
1293
check_effect_free! (ir, idx, lateres. val, rt, state)
1293
1294
return nothing
1294
1295
end
@@ -1576,7 +1577,7 @@ function handle_modifyfield!_call!(ir::IRCode, idx::Int, stmt::Expr, info::Modif
1576
1577
case === nothing && return nothing
1577
1578
stmt. head = :invoke_modify
1578
1579
pushfirst! (stmt. args, case. invoke)
1579
- ir. stmts[ idx][:inst ] = stmt
1580
+ ir[ SSAValue ( idx) ][:stmt ] = stmt
1580
1581
return nothing
1581
1582
end
1582
1583
@@ -1636,7 +1637,7 @@ end
1636
1637
function inline_const_if_inlineable! (inst:: Instruction )
1637
1638
rt = inst[:type ]
1638
1639
if rt isa Const && is_inlineable_constant (rt. val)
1639
- inst[:inst ] = quoted (rt. val)
1640
+ inst[:stmt ] = quoted (rt. val)
1640
1641
return true
1641
1642
end
1642
1643
inst[:flag ] |= IR_FLAG_EFFECT_FREE | IR_FLAG_NOTHROW
@@ -1691,7 +1692,7 @@ end
1691
1692
1692
1693
function linear_inline_eligible (ir:: IRCode )
1693
1694
length (ir. cfg. blocks) == 1 || return false
1694
- terminator = ir[SSAValue (last (ir. cfg. blocks[1 ]. stmts))][:inst ]
1695
+ terminator = ir[SSAValue (last (ir. cfg. blocks[1 ]. stmts))][:stmt ]
1695
1696
isa (terminator, ReturnNode) || return false
1696
1697
isdefined (terminator, :val ) || return false
1697
1698
return true
0 commit comments