// cse does common-subexpression elimination on the Function. // Values are just relinked, nothing is deleted. A subsequent deadcode // pass is required to actually remove duplicate expressions. func cse(f *Func) { … } type eqclass … // partitionValues partitions the values into equivalence classes // based on having all the following features match: // - opcode // - type // - auxint // - aux // - nargs // - block # if a phi op // - first two arg's opcodes and auxint // - NOT first two arg's aux; that can break CSE. // // partitionValues returns a list of equivalence classes, each // being a sorted by ID list of *Values. The eqclass slices are // backed by the same storage as the input slice. // Equivalence classes of size 1 are ignored. func partitionValues(a []*Value, auxIDs auxmap) []eqclass { … } func lt2Cmp(isLt bool) types.Cmp { … } type auxmap … func cmpVal(v, w *Value, auxIDs auxmap) types.Cmp { … }