Displays long chains of gotos not displayed by code-typed
I think this might be something to do with the function doing a lot of inlining. Consider code-typed:
julia> @code_typed (x->[x])(1)
CodeInfo(
1 ─ %1 = $(Expr(:foreigncall, :(:jl_alloc_array_1d), Vector{Int64}, svec(Any, Int64), 0, :(:ccall), Vector{Int64}, 1, 1))::Vector{Int64}
└── goto #3 if not true
2 ─ Base.arrayset(false, %1, x, 1)::Vector{Int64}
3 ┄ goto #4
4 ─ return %1
) => Vector{Int64}
vs descend
julia> @descend (x->[x])(1)
(::var"#23#24")(x) @ Main REPL[42]:1
∘ ── %0 = invoke #23(::Int64)::Vector{Int64}
1 1 ── %1 = $(Expr(:foreigncall, :(:jl_alloc_array_1d), Vector{Int64}, svec(Any, Int64), 0, :(:ccall), Vector{Int64}, 1, 1))::Vector{Int64}
2 ── goto #3 ││╻╷╷╷╷ LinearIndices
3 ── goto #4 │││┃│││ axes
4 ── goto #5 ││││┃│ map
5 ── goto #6 │││││
6 ── goto #7 ││││
7 ── goto #8 │││
8 ── nothing::Nothing │
9 ── goto #10 │││╻╷╷╷╷ axes1
10 ─ goto #11 ││││┃││ axes
11 ─ goto #12 │││││┃ oneto
12 ─ goto #13 │││││
13 ─ goto #14 ││││
14 ─ goto #15 │││
15 ─ nothing::Nothing │
16 ─ nothing::Nothing │
17 ─ Base.arrayset(false, %1, x, 1)::Vector{Int64} ││╻ setindex!
18 ─ goto #19 ││
19 ─ return %1 │
Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark.
Toggles: [o]ptimize, [w]arn, [h]ide type-stable statements, [d]ebuginfo, [r]emarks, [e]ffects, [i]nlining costs, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
Advanced: dump [P]arams cache.
I assume this is to do with the info shown on the right (you will need to scroll across to see on github). I think we should be willing to do some kind of goto compression (to match code_typed) at least by default
@oscardssmith this is why we were seeing lots of gotos. It wasn't the optimizer missing a compression step on nightly, it's Cthulu apparently it always does this even on 1.8
I'm interested in why @code_typed doesn't have this; is there a list of optimizations that are desynchronized between Cthulhu and Base?
I'm interested in why
@code_typeddoesn't have this; is there a list of optimizations that are desynchronized between Cthulhu and Base?
There's no extra optimizations, but code_typed converts back to legacy format (without basic blocks), so the basic block get recomputed much more frequently, which can have the same effects. We do have BB optimization passes we could run that are not enabled by default.