diff options
author | Keith Randall <khr@google.com> | 2018-01-03 14:38:55 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2018-02-26 23:49:44 +0000 |
commit | 4b00d3f4a2d1379377a0f2312564ae405b946d65 (patch) | |
tree | 47f957045026cb93fff0ef2a2c893245f4a9f767 /src/cmd/compile/internal/ssa/schedule.go | |
parent | 30673769ed7409da0ba1046e874371bf4f07d352 (diff) | |
download | go-4b00d3f4a2d1379377a0f2312564ae405b946d65.tar.gz go-4b00d3f4a2d1379377a0f2312564ae405b946d65.zip |
cmd/compile: implement comparisons directly with memory
Allow the compiler to generate code like CMPQ 16(AX), $7
It's tricky because it's difficult to spill such a comparison during
flagalloc, because the same memory state might not be available at
the restore locations.
Solve this problem by decomposing the compare+load back into its parts
if it needs to be spilled.
The big win is that the write barrier test goes from:
MOVL runtime.writeBarrier(SB), CX
TESTL CX, CX
JNE 60
to
CMPL runtime.writeBarrier(SB), $0
JNE 59
It's one instruction and one byte smaller.
Fixes #19485
Fixes #15245
Update #22460
Binaries are about 0.15% smaller.
Change-Id: I4fd8d1111b6b9924d52f9a0901ca1b2e5cce0836
Reviewed-on: https://go-review.googlesource.com/86035
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/schedule.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/schedule.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go index c44c243eac..8109908475 100644 --- a/src/cmd/compile/internal/ssa/schedule.go +++ b/src/cmd/compile/internal/ssa/schedule.go @@ -264,7 +264,7 @@ func schedule(f *Func) { } } if len(order) != len(b.Values) { - f.Fatalf("schedule does not include all values") + f.Fatalf("schedule does not include all values in block %s", b) } for i := 0; i < len(b.Values); i++ { b.Values[i] = order[len(b.Values)-1-i] |