aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/deadcode.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-03-24 10:36:13 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-03-24 18:00:15 +0000
commite00e57d67cea33d4faef8506ced6f3c2416cfd15 (patch)
treee84f3ef7ea308ec55e7953f409edba1ab8011cf6 /src/cmd/compile/internal/ssa/deadcode.go
parentad8c17b70328b8771ed5bbfe9161cb98f1995b84 (diff)
downloadgo-e00e57d67cea33d4faef8506ced6f3c2416cfd15.tar.gz
go-e00e57d67cea33d4faef8506ced6f3c2416cfd15.zip
cmd/compile: ignore all unreachable values during simple phi insertion
Simple phi insertion already had a heuristic to check for dead blocks, namely having no predecessors. When we stopped generating code for dead blocks, we eliminated some values contained in more subtle dead blocks, which confused phi insertion. Compensate by beefing up the reachability check. Fixes #19678 Change-Id: I0081e4a46f7ce2f69b131a34a0553874a0cb373e Reviewed-on: https://go-review.googlesource.com/38602 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/deadcode.go')
-rw-r--r--src/cmd/compile/internal/ssa/deadcode.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/ssa/deadcode.go b/src/cmd/compile/internal/ssa/deadcode.go
index ce786a964b..b24ecaa4c4 100644
--- a/src/cmd/compile/internal/ssa/deadcode.go
+++ b/src/cmd/compile/internal/ssa/deadcode.go
@@ -6,13 +6,13 @@ package ssa
// findlive returns the reachable blocks and live values in f.
func findlive(f *Func) (reachable []bool, live []bool) {
- reachable = reachableBlocks(f)
+ reachable = ReachableBlocks(f)
live = liveValues(f, reachable)
return
}
-// reachableBlocks returns the reachable blocks in f.
-func reachableBlocks(f *Func) []bool {
+// ReachableBlocks returns the reachable blocks in f.
+func ReachableBlocks(f *Func) []bool {
reachable := make([]bool, f.NumBlocks())
reachable[f.Entry.ID] = true
p := []*Block{f.Entry} // stack-like worklist
@@ -106,7 +106,7 @@ func deadcode(f *Func) {
}
// Find reachable blocks.
- reachable := reachableBlocks(f)
+ reachable := ReachableBlocks(f)
// Get rid of edges from dead to live code.
for _, b := range f.Blocks {