Skip to content

cmd/compile: Renumbering Value IDs before register allocation can save time/space #15652

@dr2chase

Description

@dr2chase

Some large inputs (see #15537) create a large number of ssa values early in the compilation, but most of those disappear early (because of excess LocalRef/Copy/Phi creation that is optimized out). Func.NumValues() however continues to return the high-water-mark for value ID, which leads to overallocation of various intermediate data structures. This is especially costly in register allocation.

Renumbering the range of Value Ids to compress the range saves time and space.

The benefits of renumbering are reduced by other methods for reducing unnecessary Value creation; eliminating Call blocks is one way (see #15631 for this), sparse methods for finding/creating phi functions is another (see https://go-review.googlesource.com/#/c/22342/ ). Renumbering will interfere with tracking values in the ssa.html debugging output; however, for the inputs where renumbering produces a noticeable improvement the ssa.html files are so large as to be unwieldy (gigabytes).
#15631 contains an early discussion of the motivation for this bug/fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions