@@ -362,9 +362,8 @@ function _structural_analysis!(ci::CodeInstance, world::UInt, settings::Settings
362362 compact. result_idx -= 1
363363 new_args = _flatten_parameter! (Compiler. optimizer_lattice (refiner), compact, callee_codeinst. inferred. ir. argtypes, arg-> stmt. args[arg+ 1 ], line, settings)
364364
365- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
366- new_call = insert_node_here! (compact,
367- NewInstruction (Expr (:invoke , (StructuralSSARef (compact. result_idx), callee_codeinst), new_args... ), stmtype, info, thisline, stmtflags))
365+ new_call = insert_instruction! (compact, settings, @__SOURCE__ ,
366+ NewInstruction (Expr (:invoke , (StructuralSSARef (compact. result_idx), callee_codeinst), new_args... ), stmtype, info, line, stmtflags))
368367 compact. ssa_rename[compact. idx - 1 ] = new_call
369368
370369 cms = CallerMappingState (result, refiner. var_to_diff, refiner. varclassification, refiner. varkinds, eqclassification, eqkinds)
@@ -388,8 +387,7 @@ function _structural_analysis!(ci::CodeInstance, world::UInt, settings::Settings
388387 Compiler. delete_inst_here! (compact)
389388
390389 (new_ret, ultimate_rt) = rewrite_ipo_return! (Compiler. typeinf_lattice (refiner), compact, line, settings, ret_stmt. val, ultimate_rt, eqvars)
391- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
392- insert_node_here! (compact, NewInstruction (ReturnNode (new_ret), ultimate_rt, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
390+ insert_instruction! (compact, settings, @__SOURCE__ , NewInstruction (ReturnNode (new_ret), ultimate_rt, Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), reverse_affinity = true )
393391 elseif isa (ultimate_rt, Type)
394392 # If we don't have any internal variables (in which case we might have to to do a more aggressive rewrite), strengthen the incidence
395393 # by demoting to full incidence over the argument variables. Incidence is not allowed to propagate through global mutable state, so
@@ -427,27 +425,23 @@ function rewrite_ipo_return!(𝕃, compact::IncrementalCompact, line, settings,
427425 new_types = Any[]
428426 for i = 1 : length (ultimate_rt. fields)
429427 ssa_type = Compiler. getfield_tfunc (𝕃, ultimate_rt, Const (i))
430- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
431- ssa_field = insert_node_here! (compact,
432- NewInstruction (Expr (:call , getfield, variable), ssa_type, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
428+ ssa_field = insert_instruction! (compact, settings, @__SOURCE__ ,
429+ NewInstruction (Expr (:call , getfield, variable), ssa_type, Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), reverse_affinity = true )
433430
434431 (new_field, new_type) = rewrite_ipo_return! (𝕃, compact, line, settings, ssa_field, ssa_type, eqvars)
435432 push! (new_fields, new_field)
436433 push! (new_types, new_type)
437434 end
438435 newT = Compiler. PartialStruct (ultimate_rt. typ, new_types)
439436 if widenconst (ultimate_rt) <: Tuple
440- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
441- retssa = insert_node_here! (compact,
442- NewInstruction (Expr (:call , tuple, new_fields... ), newT, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
437+ retssa = insert_instruction! (compact, settings, @__SOURCE__ ,
438+ NewInstruction (Expr (:call , tuple, new_fields... ), newT, Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), reverse_affinity = true )
443439 else
444- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
445- T = insert_node_here! (compact,
446- NewInstruction (Expr (:call , typeof, ssa), Type, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
440+ T = insert_instruction! (compact, settings, @__SOURCE__ ,
441+ NewInstruction (Expr (:call , typeof, ssa), Type, Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), reverse_affinity = true )
447442
448- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
449- retssa = insert_node_here! (compact,
450- NewInstruction (Expr (:new , T, new_fields... ), newT, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
443+ retssa = insert_instruction! (compact, settings, @__SOURCE__ ,
444+ NewInstruction (Expr (:new , T, new_fields... ), newT, Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), reverse_affinity = true )
451445 end
452446 return Pair {Any, Any} (retssa, newT)
453447 end
@@ -460,9 +454,8 @@ function rewrite_ipo_return!(𝕃, compact::IncrementalCompact, line, settings,
460454 push! (eqvars. varclassification, External)
461455 push! (eqvars. varkinds, Intrinsics. Continuous)
462456
463- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
464- new_var_ssa = insert_node_here! (compact,
465- NewInstruction (Expr (:invoke , nothing , variable), Incidence (nonlinrepl), Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
457+ new_var_ssa = insert_instruction! (compact, settings,
458+ NewInstruction (Expr (:invoke , nothing , variable), Incidence (nonlinrepl), Compiler. NoCallInfo (), line, Compiler. IR_FLAG_REFINED), true )
466459
467460 eq_incidence = ultimate_rt - Incidence (nonlinrepl)
468461 push! (eqvars. total_incidence, eq_incidence)
@@ -471,17 +464,14 @@ function rewrite_ipo_return!(𝕃, compact::IncrementalCompact, line, settings,
471464 push! (eqvars. eqkinds, Intrinsics. Always)
472465 new_eq = length (eqvars. total_incidence)
473466
474- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
475- new_eq_ssa = insert_node_here! (compact,
476- NewInstruction (Expr (:invoke , nothing , equation), Eq (new_eq), Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
467+ new_eq_ssa = insert_instruction! (compact, settings, @__SOURCE__ ,
468+ NewInstruction (Expr (:invoke , nothing , equation), Eq (new_eq), Compiler. NoCallInfo (), LINE, Compiler. IR_FLAG_REFINED), true )
477469
478- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
479- eq_val_ssa = insert_node_here! (compact,
480- NewInstruction (Expr (:call , InternalIntrinsics. assign_var, new_var_ssa, ssa), eq_incidence, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
470+ eq_val_ssa = insert_instruction! (compact, settings, @__SOURCE__ ,
471+ NewInstruction (Expr (:call , InternalIntrinsics. assign_var, new_var_ssa, ssa), eq_incidence, Compiler. NoCallInfo (), LINE, Compiler. IR_FLAG_REFINED), true )
481472
482- thisline = maybe_insert_debuginfo! (compact, settings, @__SOURCE__ (), line)
483- eq_call_ssa = insert_node_here! (compact,
484- NewInstruction (Expr (:invoke , nothing , new_eq_ssa, eq_val_ssa), Nothing, Compiler. NoCallInfo (), thisline, Compiler. IR_FLAG_REFINED), true )
473+ eq_call_ssa = insert_instruction! (compact, settings, @__SOURCE__ ,
474+ NewInstruction (Expr (:invoke , nothing , new_eq_ssa, eq_val_ssa), Nothing, Compiler. NoCallInfo (), LINE, Compiler. IR_FLAG_REFINED), true )
485475
486476 T = widenconst (ultimate_rt)
487477 # TODO : We don't have a way to express that the return value is directly this variable for arbitrary types
0 commit comments