aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/shortcircuit.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2020-04-18 18:00:40 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2020-04-20 19:36:50 +0000
commit0239a5c47856f758b9277e23c40a067c9644a7c8 (patch)
tree8f83847de7a7efc0b532abb8fb9713a47596bf26 /src/cmd/compile/internal/ssa/shortcircuit.go
parentc9af5523f324a031b23c6f1dcf448c051c994c00 (diff)
downloadgo-0239a5c47856f758b9277e23c40a067c9644a7c8.tar.gz
go-0239a5c47856f758b9277e23c40a067c9644a7c8.zip
cmd/compile: use fuse to implement shortcircuit loop
The rewrite loop in shortcircuit is identical to the one in fuse. That's not surprising; shortcircuit is fuse-like. Take advantage of that by merging the two loops. Passes toolstash-check. Change-Id: I642cb39a23d2ac8964ed577678f062fce721439c Reviewed-on: https://go-review.googlesource.com/c/go/+/229003 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/shortcircuit.go')
-rw-r--r--src/cmd/compile/internal/ssa/shortcircuit.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/cmd/compile/internal/ssa/shortcircuit.go b/src/cmd/compile/internal/ssa/shortcircuit.go
index 9f18117066..c5df457c4e 100644
--- a/src/cmd/compile/internal/ssa/shortcircuit.go
+++ b/src/cmd/compile/internal/ssa/shortcircuit.go
@@ -58,20 +58,7 @@ func shortcircuit(f *Func) {
// if v goto t else u
// We can redirect p to go directly to t instead of b.
// (If v is not live after b).
- for changed := true; changed; {
- changed = false
- for i := len(f.Blocks) - 1; i >= 0; i-- {
- b := f.Blocks[i]
- if fuseBlockPlain(b) {
- changed = true
- continue
- }
- changed = shortcircuitBlock(b) || changed
- }
- if changed {
- f.invalidateCFG()
- }
- }
+ fuse(f, fuseTypePlain|fuseTypeShortCircuit)
}
// shortcircuitBlock checks for a CFG in which an If block