From fe5619b479859f199a244929770a11cc4cbd1911 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 1 Sep 2016 10:13:11 -0700 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Josh Bleecher Snyder --- src/cmd/compile/internal/ssa/tighten.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.48.1