Skip to content

Commit fd23547

Browse files
aviateskKristofferC
authored andcommitted
optimizations: improve Core._apply_iterate call conversion in #59548 (#59601)
Further improves the implementation from #59548. Specifically, uses `widenconst` to enable conversion of `tuple` calls that have become `PartialStruct`, and removes incorrect comments and unused arguments. Also adds some Julia-IR level tests. (cherry picked from commit a4e02ca)
1 parent ad32b08 commit fd23547

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Compiler/test/irpasses.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,3 +2059,17 @@ let src = code_typed1((Vector{Any},)) do xs
20592059
end
20602060
@test count(iscall((src, Core.svec)), src.code) == 1
20612061
end
2062+
2063+
# JuliaLang/julia #59548
2064+
# Rewrite `Core._apply_iterate` to use `Core.svec` instead of `tuple` to better match
2065+
# the codegen ABI
2066+
let src = code_typed1((Vector{Any},)) do xs
2067+
println(stdout, xs...)
2068+
end
2069+
@test count(iscall((src, Core.svec)), src.code) == 1
2070+
end
2071+
let src = code_typed1((Vector{Any},)) do xs
2072+
println(stdout, 1, xs...) # convert tuples represented by `PartialStruct`
2073+
end
2074+
@test count(iscall((src, Core.svec)), src.code) == 1
2075+
end

0 commit comments

Comments
 (0)