@@ -872,14 +872,15 @@ function perform_lifting!(compact::IncrementalCompact,
872
872
return Pair {Any, PhiNest} (stmt_val, PhiNest (visited_philikes, lifted_philikes, lifted_leaves, reverse_mapping, walker_callback))
873
873
end
874
874
875
- function lift_apply_args! (compact:: IncrementalCompact , idx:: Int , stmt:: Expr , 𝕃ₒ:: AbstractLattice )
876
- # Handle _apply_iterate calls: convert arguments to use `Core.svec`. The behavior of Core.svec (with boxing) better matches the ABI of codegen.
875
+ # Handle _apply_iterate calls: convert arguments to use `Core.svec`.
876
+ # The behavior of `Core.svec` (with boxing) better matches the ABI of codegen.
877
+ function lift_apply_args! (compact:: IncrementalCompact , idx:: Int , stmt:: Expr )
877
878
compact[idx] = nothing
878
- for i in 4 : length (stmt. args) # Skip iterate function, f , and first iterator
879
+ for i in 4 : length (stmt. args) # Skip `_apply_iterate`, `iterate` , and the function
879
880
arg = stmt. args[i]
880
- arg_type = argextype (arg, compact)
881
- svec_args = nothing
881
+ arg_type = widenconst (argextype (arg, compact))
882
882
if isa (arg_type, DataType) && arg_type. name === Tuple. name
883
+ svec_args = nothing
883
884
if isa (arg, SSAValue)
884
885
arg_stmt = compact[arg][:stmt ]
885
886
if is_known_call (arg_stmt, Core. tuple, compact)
@@ -900,15 +901,14 @@ function lift_apply_args!(compact::IncrementalCompact, idx::Int, stmt::Expr,
900
901
end
901
902
end
902
903
end
903
- end
904
- # Create Core.svec call if we have arguments
905
- if svec_args != = nothing
906
- svec_args[1 ] = GlobalRef (Core, :svec )
907
- new_svec_call = Expr (:call )
908
- new_svec_call. args = svec_args
909
- inst = compact[SSAValue (idx)]
910
- new_svec_ssa = insert_node! (compact, SSAValue (idx), NewInstruction (new_svec_call, SimpleVector, NoCallInfo (), inst[:line ], inst[:flag ]))
911
- stmt. args[i] = new_svec_ssa
904
+ if svec_args != = nothing
905
+ svec_args[1 ] = GlobalRef (Core, :svec )
906
+ new_svec_call = Expr (:call )
907
+ new_svec_call. args = svec_args
908
+ inst = compact[SSAValue (idx)]
909
+ new_svec_ssa = insert_node! (compact, SSAValue (idx), NewInstruction (new_svec_call, SimpleVector, NoCallInfo (), inst[:line ], inst[:flag ]))
910
+ stmt. args[i] = new_svec_ssa
911
+ end
912
912
end
913
913
end
914
914
compact[idx] = stmt
@@ -1420,7 +1420,7 @@ function sroa_pass!(ir::IRCode, inlining::Union{Nothing,InliningState}=nothing)
1420
1420
refine_new_effects! (𝕃ₒ, compact, idx, stmt)
1421
1421
elseif is_known_call (stmt, Core. _apply_iterate, compact)
1422
1422
length (stmt. args) >= 4 || continue
1423
- lift_apply_args! (compact, idx, stmt, 𝕃ₒ )
1423
+ lift_apply_args! (compact, idx, stmt)
1424
1424
end
1425
1425
continue
1426
1426
end
0 commit comments