diff options
| author | Keith Randall <khr@golang.org> | 2015-12-17 10:01:24 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2015-12-21 23:12:05 +0000 |
| commit | 7d9f1067d1c8a2d0252fa2a115f1d016f94f7087 (patch) | |
| tree | ef655a345667fd21416907cef77fb77a5a1ac4d7 /src/cmd/compile/internal/ssa/flagalloc.go | |
| parent | 5b355a7907550d6fe457fdf6a92fc320d5a764d5 (diff) | |
| download | go-7d9f1067d1c8a2d0252fa2a115f1d016f94f7087.tar.xz | |
[dev.ssa] cmd/compile: better register allocator
Reorder how register & stack allocation is done. We used to allocate
registers, then fix up merge edges, then allocate stack slots. This
lead to lots of unnecessary copies on merge edges:
v2 = LoadReg v1
v3 = StoreReg v2
If v1 and v3 are allocated to the same stack slot, then this code is
unnecessary. But at regalloc time we didn't know the homes of v1 and
v3.
To fix this problem, allocate all the stack slots before fixing up the
merge edges. That way, we know what stack slots values use so we know
what copies are required.
Use a good technique for shuffling values around on merge edges.
Improves performance of the go1 TimeParse benchmark by ~12%
Change-Id: I731f43e4ff1a7e0dc4cd4aa428fcdb97812b86fa
Reviewed-on: https://go-review.googlesource.com/17915
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/flagalloc.go')
| -rw-r--r-- | src/cmd/compile/internal/ssa/flagalloc.go | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/ssa/flagalloc.go b/src/cmd/compile/internal/ssa/flagalloc.go index 714ac016a2..c088158057 100644 --- a/src/cmd/compile/internal/ssa/flagalloc.go +++ b/src/cmd/compile/internal/ssa/flagalloc.go @@ -21,15 +21,6 @@ func flagalloc(f *Func) { // Walk blocks backwards. Poor-man's postorder traversal. for i := len(f.Blocks) - 1; i >= 0; i-- { b := f.Blocks[i] - if len(b.Preds) > 1 { - // Don't use any flags register at the start - // of a merge block. This causes problems - // in regalloc because some of the rematerialization - // instructions used on incoming merge edges clobber - // the flags register. - // TODO: only for architectures where this matters? - continue - } // Walk values backwards to figure out what flag // value we want in the flag register at the start // of the block. |
