]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: remove loop in shortcircuit
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 8 Mar 2020 18:07:52 +0000 (11:07 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 13 Mar 2020 19:42:14 +0000 (19:42 +0000)
commit4ad643d2089b73fbcfc2c0e3f61cb63dcb217ec5
tree4ee3d207007769509e56143e303273399c194389
parent74bc90a9a86365ca158a2d4e8697b0f4650e31c5
cmd/compile: remove loop in shortcircuit

shortcircuitBlock contained a loop to handle blocks like

b: <- p q
  v = Phi true false
If v -> t u

in a single execution.
This change makes shortcircuitBlock do it in two instead,
one for each constant phi arg.

Motivation: Upcoming changes will expand the range of
blocks that the shortcircuit pass can handle.
Those changes need to understand what the CFG
will look like after the rewrite in shortcircuitBlock.
Making shortcircuitBlock do only a single CFG
modification at a time significantly simplifies that code.

In theory, this is less efficient, but not measurably so.
There is minor, unimportant churn in the generated code.

Updates #37608

Change-Id: Ia6dce7011e3e19b546ed1e176bd407575a0ab837
Reviewed-on: https://go-review.googlesource.com/c/go/+/222918
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/shortcircuit.go