go/src/cmd/compile/internal/ssa/layout.go

181 lines
4.1 KiB
Go
Raw Normal View History

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ssa
// layout orders basic blocks in f with the goal of minimizing control flow instructions.
// After this phase returns, the order of f.Blocks matters and is the order
// in which those blocks will appear in the assembly output.
func layout(f *Func) {
f.Blocks = layoutOrder(f)
}
// Register allocation may use a different order which has constraints
// imposed by the linear-scan algorithm. Note that f.pass here is
// regalloc, so the switch is conditional on -d=ssa/regalloc/test=N
func layoutRegallocOrder(f *Func) []*Block {
switch f.pass.test {
case 0: // layout order
return layoutOrder(f)
case 1: // existing block order
return f.Blocks
case 2: // reverse of postorder; legal, but usually not good.
po := f.postorder()
visitOrder := make([]*Block, len(po))
for i, b := range po {
j := len(po) - i - 1
visitOrder[j] = b
}
return visitOrder
}
return nil
}
func layoutOrder(f *Func) []*Block {
order := make([]*Block, 0, f.NumBlocks())
scheduled := make([]bool, f.NumBlocks())
idToBlock := make([]*Block, f.NumBlocks())
indegree := make([]int, f.NumBlocks())
2016-01-28 22:19:46 -06:00
posdegree := f.newSparseSet(f.NumBlocks()) // blocks with positive remaining degree
defer f.retSparseSet(posdegree)
zerodegree := f.newSparseSet(f.NumBlocks()) // blocks with zero remaining degree
defer f.retSparseSet(zerodegree)
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
exit := f.newSparseSet(f.NumBlocks()) // exit blocks
defer f.retSparseSet(exit)
// Populate idToBlock and find exit blocks.
for _, b := range f.Blocks {
idToBlock[b.ID] = b
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
if b.Kind == BlockExit {
exit.add(b.ID)
}
}
// Expand exit to include blocks post-dominated by exit blocks.
for {
changed := false
for _, id := range exit.contents() {
b := idToBlock[id]
NextPred:
for _, pe := range b.Preds {
p := pe.b
if exit.contains(p.ID) {
continue
}
for _, s := range p.Succs {
if !exit.contains(s.b.ID) {
continue NextPred
}
}
// All Succs are in exit; add p.
exit.add(p.ID)
changed = true
}
}
if !changed {
break
}
}
// Initialize indegree of each block
for _, b := range f.Blocks {
if exit.contains(b.ID) {
// exit blocks are always scheduled last
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
continue
}
indegree[b.ID] = len(b.Preds)
if len(b.Preds) == 0 {
zerodegree.add(b.ID)
} else {
posdegree.add(b.ID)
}
}
bid := f.Entry.ID
blockloop:
for {
// add block to schedule
b := idToBlock[bid]
order = append(order, b)
scheduled[bid] = true
if len(order) == len(f.Blocks) {
break
}
for _, e := range b.Succs {
c := e.b
indegree[c.ID]--
if indegree[c.ID] == 0 {
posdegree.remove(c.ID)
zerodegree.add(c.ID)
}
}
// Pick the next block to schedule
// Pick among the successor blocks that have not been scheduled yet.
// Use likely direction if we have it.
var likely *Block
switch b.Likely {
case BranchLikely:
likely = b.Succs[0].b
case BranchUnlikely:
likely = b.Succs[1].b
}
if likely != nil && !scheduled[likely.ID] {
bid = likely.ID
continue
}
// Use degree for now.
bid = 0
mindegree := f.NumBlocks()
for _, e := range order[len(order)-1].Succs {
c := e.b
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
if scheduled[c.ID] || c.Kind == BlockExit {
continue
}
if indegree[c.ID] < mindegree {
mindegree = indegree[c.ID]
bid = c.ID
}
}
if bid != 0 {
continue
}
// TODO: improve this part
// No successor of the previously scheduled block works.
// Pick a zero-degree block if we can.
for zerodegree.size() > 0 {
cid := zerodegree.pop()
if !scheduled[cid] {
bid = cid
continue blockloop
}
}
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
// Still nothing, pick any non-exit block.
for posdegree.size() > 0 {
cid := posdegree.pop()
if !scheduled[cid] {
bid = cid
continue blockloop
}
}
cmd/compile: lay out exit blocks last In Go 1.8.x, panics are generally scheduled at the very end of functions. That property was lost in Go 1.9; this CL restores it. This helps with the Fannkuch benchmark: name old time/op new time/op delta Fannkuch11-8 2.74s ± 2% 2.55s ± 2% -7.03% (p=0.000 n=20+20) This increases the fannkuch function size from 801 bytes to 831 bytes, but that is still smaller than Go 1.8.1 at 844 bytes. It generally increases binary size a tiny amount. Negligible compiler performance impact. For the code in #14758: name old time/op new time/op delta Foo-8 326ns ± 3% 312ns ± 3% -4.32% (p=0.000 n=28+30) Bar-8 560ns ± 2% 565ns ± 2% +0.96% (p=0.002 n=30+27) Updates #18977 name old alloc/op new alloc/op delta Template 38.8MB ± 0% 38.8MB ± 0% ~ (p=0.690 n=5+5) Unicode 28.7MB ± 0% 28.7MB ± 0% ~ (p=0.841 n=5+5) GoTypes 109MB ± 0% 109MB ± 0% ~ (p=0.690 n=5+5) Compiler 457MB ± 0% 457MB ± 0% ~ (p=0.841 n=5+5) SSA 1.10GB ± 0% 1.10GB ± 0% +0.03% (p=0.032 n=5+5) Flate 24.4MB ± 0% 24.5MB ± 0% ~ (p=0.690 n=5+5) GoParser 30.9MB ± 0% 30.9MB ± 0% ~ (p=0.421 n=5+5) Reflect 73.3MB ± 0% 73.3MB ± 0% ~ (p=1.000 n=5+5) Tar 25.5MB ± 0% 25.5MB ± 0% ~ (p=0.095 n=5+5) XML 40.8MB ± 0% 40.9MB ± 0% ~ (p=0.056 n=5+5) [Geo mean] 71.6MB 71.6MB +0.01% name old allocs/op new allocs/op delta Template 395k ± 0% 394k ± 1% ~ (p=1.000 n=5+5) Unicode 344k ± 0% 344k ± 0% ~ (p=0.690 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% ~ (p=0.421 n=5+5) Compiler 4.41M ± 0% 4.41M ± 0% ~ (p=0.841 n=5+5) SSA 9.79M ± 0% 9.79M ± 0% ~ (p=0.310 n=5+5) Flate 237k ± 0% 237k ± 0% ~ (p=0.841 n=5+5) GoParser 321k ± 0% 321k ± 1% ~ (p=0.421 n=5+5) Reflect 956k ± 0% 956k ± 0% ~ (p=1.000 n=5+5) Tar 251k ± 1% 252k ± 0% ~ (p=0.095 n=5+5) XML 399k ± 0% 400k ± 0% ~ (p=0.222 n=5+5) [Geo mean] 741k 741k +0.03% name old object-bytes new object-bytes delta Template 386k ± 0% 386k ± 0% +0.05% (p=0.008 n=5+5) Unicode 202k ± 0% 202k ± 0% +0.02% (p=0.008 n=5+5) GoTypes 1.16M ± 0% 1.16M ± 0% +0.07% (p=0.008 n=5+5) Compiler 3.91M ± 0% 3.91M ± 0% +0.05% (p=0.008 n=5+5) SSA 7.86M ± 0% 7.87M ± 0% +0.07% (p=0.008 n=5+5) Flate 227k ± 0% 227k ± 0% +0.10% (p=0.008 n=5+5) GoParser 283k ± 0% 283k ± 0% +0.04% (p=0.008 n=5+5) Reflect 950k ± 0% 951k ± 0% +0.04% (p=0.008 n=5+5) Tar 187k ± 0% 187k ± 0% -0.03% (p=0.008 n=5+5) XML 406k ± 0% 406k ± 0% +0.04% (p=0.008 n=5+5) [Geo mean] 647k 647k +0.04% Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df Reviewed-on: https://go-review.googlesource.com/43293 Reviewed-by: Keith Randall <khr@golang.org>
2017-05-12 06:10:25 -07:00
// Pick any exit block.
// TODO: Order these to minimize jump distances?
for {
cid := exit.pop()
if !scheduled[cid] {
bid = cid
continue blockloop
}
}
}
f.laidout = true
return order
//f.Blocks = order
}