]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile: optimization for && and || expressions
authorKeith Randall <khr@golang.org>
Mon, 25 Jan 2016 17:21:17 +0000 (09:21 -0800)
committerKeith Randall <khr@golang.org>
Fri, 29 Jan 2016 17:49:45 +0000 (17:49 +0000)
commitd8a65672f8605d9d51fd90996162ab8d79a4aa32
tree96ac1829ad346811c93749995d5fe765c6655b8b
parent9d6e605cf7c2b8b9c279e687d06bc92a8ade6fcc
[dev.ssa] cmd/compile: optimization for && and || expressions

Compiling && and || expressions often leads to control
flow of the following form:

p:
  If a goto b else c
b: <- p ...
  x = phi(a, ...)
  If x goto t else u

Note that if we take the edge p->b, then we are guaranteed
to take the edge b->t also.  So in this situation, we might
as well go directly from p to t.

Change-Id: I6974f1e6367119a2ddf2014f9741fdb490edcc12
Reviewed-on: https://go-review.googlesource.com/18910
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/compile.go
src/cmd/compile/internal/ssa/gen/genericOps.go
src/cmd/compile/internal/ssa/shortcircuit.go [new file with mode: 0644]
src/cmd/compile/internal/ssa/shortcircuit_test.go [new file with mode: 0644]