]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: Handle ONOT in conditionals as well
authorKeith Randall <khr@golang.org>
Tue, 3 Nov 2015 17:30:17 +0000 (09:30 -0800)
committerKeith Randall <khr@golang.org>
Tue, 3 Nov 2015 18:36:14 +0000 (18:36 +0000)
Might as well, for a && !(b && c) and the like.

Change-Id: I2548b6e6ee5870e074bcef6edd56a7db6e81d70f
Reviewed-on: https://go-review.googlesource.com/16600
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>

src/cmd/compile/internal/gc/ssa.go

index 2c935b724713253679f735eaabfa525f1b77667b..90abd8e05d8025e9c44ee96f2c1bb1acbb026a99 100644 (file)
@@ -2026,6 +2026,11 @@ func (s *state) condBranch(cond *Node, yes, no *ssa.Block, likely int8) {
                // If likely==1, then we don't have enough info to decide
                // the likelihood of the first branch.
        }
+       if cond.Op == ONOT {
+               s.stmtList(cond.Ninit)
+               s.condBranch(cond.Left, no, yes, -likely)
+               return
+       }
        c := s.expr(cond)
        b := s.endBlock()
        b.Kind = ssa.BlockIf