]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: be more aggressive in tighten pass for booleans
authorKeith Randall <khr@golang.org>
Thu, 1 Sep 2016 17:13:11 +0000 (10:13 -0700)
committerKeith Randall <khr@golang.org>
Thu, 1 Sep 2016 20:23:41 +0000 (20:23 +0000)
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>
src/cmd/compile/internal/ssa/tighten.go

index 5be55ac858848244c506a1d6a0f2f12e48eb49b3..07f0375889fe0b56151b2be1d8901d791f8262af 100644 (file)
@@ -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