Commit fe5619b4 authored by Keith Randall's avatar Keith Randall

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: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
parent c5387951
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment