aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/tighten.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2016-06-01 06:41:08 -0400
committerCherry Zhang <cherryyz@google.com>2016-06-08 20:37:13 +0000
commit225ef76c250fc9ab9794fd723952209e2ff440aa (patch)
treedf4dea32624eb22027dcde8271b2fe9bd11da907 /src/cmd/compile/internal/ssa/tighten.go
parent59e11d782717407fcdf288664a48beb52336d42a (diff)
downloadgo-225ef76c250fc9ab9794fd723952209e2ff440aa.tar.gz
go-225ef76c250fc9ab9794fd723952209e2ff440aa.zip
[dev.ssa] cmd/compile: fix scheduling of tuple ops
We want tuple-reading ops immediately follow tuple-generating op, so that tuple values will not be spilled/copied. The mechanism introduced in the previous CL cannot really avoid tuples interleaving. In this CL we always emit tuple and their selectors together. Maybe remove the tuple scores if it does not help on performance (todo). Also let tighten not move tuple-reading ops across blocks. In the previous CL a special case of regenerating flags with tuple-reading pseudo-op is added, but it did not cover end-of-block case. This is fixed in this CL and the condition is generalized. Progress on SSA backend for ARM. Still not complete. Updates #15365. Change-Id: I8980b34e7a64eb98153540e9e19a3782e20406ff Reviewed-on: https://go-review.googlesource.com/23792 Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/tighten.go')
-rw-r--r--src/cmd/compile/internal/ssa/tighten.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/tighten.go b/src/cmd/compile/internal/ssa/tighten.go
index ecb43c101d..7f800655b0 100644
--- a/src/cmd/compile/internal/ssa/tighten.go
+++ b/src/cmd/compile/internal/ssa/tighten.go
@@ -54,13 +54,16 @@ func tighten(f *Func) {
for _, b := range f.Blocks {
for i := 0; i < len(b.Values); i++ {
v := b.Values[i]
- if v.Op == OpPhi || v.Op == OpGetClosurePtr || v.Op == OpConvert || v.Op == OpArg {
+ switch v.Op {
+ case OpPhi, OpGetClosurePtr, OpConvert, OpArg, OpSelect0, OpSelect1:
// GetClosurePtr & Arg must stay in entry block.
// OpConvert must not float over call sites.
+ // Select{0,1} reads a tuple, it must stay with the tuple-generating op.
// TODO do we instead need a dependence edge of some sort for OpConvert?
// Would memory do the trick, or do we need something else that relates
// to safe point operations?
continue
+ default:
}
if len(v.Args) > 0 && v.Args[len(v.Args)-1].Type.IsMemory() {
// We can't move values which have a memory arg - it might