Compiler: Avoid copying SCC proofs into every consumer (#64115)
When some members of an inference cycle are not published, e.g. limited
results that are tombstoned, `propagate_unpublished_cycle_proof!`
attaches a proof made of the edges of all the cycle members to each
consumer. Every published consumer then materializes that proof into
its own edges and registers backedges for all of them, which costs
O(consumers × cycle edges). Since #62359, this made inferring code with
large recursive cycles much slower. The compiler itself was such code,
until #63634 changed its `typeinf` loop so that it no longer forms the
large cycle, but other code with large recursive cycles is still
affected.
This commit gives the cycle-wide proof only to one published member of
the cycle, and makes the other consumers depend on the CodeInstance of
that member instead. Since invalidating a CodeInstance also invalidates
every caller whose edges contain it, the consumers are invalidated as
before, while the proof is materialized and its backedges are
registered only once. When no member is published, the proof is still
attached to every consumer.
In addition, `finish!` no longer materializes the edges of tombstoned
results: these are neither published nor used as edges, since their
callers copy their internal edges instead.
The table below is from release builds of Julia with #63634 reverted
to recreate the large cycles. The harness infers the compiler's own
`typeinf` with an `AbstractInterpreter` that uses aggressive constant
propagation (median of three runs), and JET's self check runs the first
analysis of its `test/self_check.jl`. The inference results stay the
same.
| | before | after |
|-----------------------------|-----------:|--------:|
| harness: time | 48.5 s | 23.3 s |
| harness: materialized edges | 12,003,377 | 869,480 |
| JET's self check: time | 744 s | 122 s |
Assisted-by: Claude Code (Opus 5.5)