func LowerAllocsToStack(f *ssa.Function) { pending := make([]ssa.Value, 0, 10) for _, b := range f.Blocks { for _, instr := range b.Instrs { if alloc, ok := instr.(*ssa.Alloc); ok && alloc.Heap && !escapes(alloc, alloc.Block(), pending) { alloc.Heap = false f.Locals = append(f.Locals, alloc) } } } }