aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/tighten.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-09-01 10:13:11 -0700
committerKeith Randall <khr@golang.org>2016-09-01 20:23:41 +0000
commitfe5619b479859f199a244929770a11cc4cbd1911 (patch)
treee6e65258e4582a987b6bd9f991f21927c028a725 /src/cmd/compile/internal/ssa/tighten.go
parentc53879512f38982b1e773fd2aeecee4ebf382006 (diff)
downloadgo-fe5619b479859f199a244929770a11cc4cbd1911.tar.gz
go-fe5619b479859f199a244929770a11cc4cbd1911.zip
cmd/compile: be more aggressive in tighten pass for booleans
Fixes #15509 Change-Id: I44073533f02d38795f9ba9b255db4d1ee426d70e Reviewed-on: https://go-review.googlesource.com/28390 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.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 5be55ac858..07f0375889 100644
--- a/src/cmd/compile/internal/ssa/tighten.go
+++ b/src/cmd/compile/internal/ssa/tighten.go
@@ -73,12 +73,15 @@ func tighten(f *Func) {
// make two memory values live across a block boundary.
continue
}
- if uses[v.ID] == 1 && !phi[v.ID] && home[v.ID] != b && len(v.Args) < 2 {
+ if uses[v.ID] == 1 && !phi[v.ID] && home[v.ID] != b && (len(v.Args) < 2 || v.Type.IsBoolean()) {
// v is used in exactly one block, and it is not b.
// Furthermore, it takes at most one input,
// so moving it will not increase the
// number of live values anywhere.
// Move v to that block.
+ // Also move bool generators even if they have more than 1 input.
+ // They will likely be converted to flags, and we want flag
+ // generators moved next to uses (because we only have 1 flag register).
c := home[v.ID]
c.Values = append(c.Values, v)
v.Block = c