aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/deadcode.go
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2018-05-29 10:30:54 -0700
committerKeith Randall <khr@golang.org>2018-05-29 17:45:36 +0000
commitdb9341a02424a80a93ad50b362b881544b685e19 (patch)
treee74be060e7d2626f6227a577acf5360d4461cc86 /src/cmd/compile/internal/ssa/deadcode.go
parentb65934f237f80242a907c46ef9cf103ad6959e9f (diff)
downloadgo-db9341a02424a80a93ad50b362b881544b685e19.tar.gz
go-db9341a02424a80a93ad50b362b881544b685e19.zip
cmd/compile: update WBLoads during deadcode
When we deadcode-remove a block which is a write barrier test, remove that block from the list of write barrier test blocks. Fixes #25516 Change-Id: I1efe732d5476003eab4ad6bf67d0340d7874ff0c Reviewed-on: https://go-review.googlesource.com/115037 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/deadcode.go')
-rw-r--r--src/cmd/compile/internal/ssa/deadcode.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/deadcode.go b/src/cmd/compile/internal/ssa/deadcode.go
index 322ea82c8d..13b7d7e1e8 100644
--- a/src/cmd/compile/internal/ssa/deadcode.go
+++ b/src/cmd/compile/internal/ssa/deadcode.go
@@ -252,6 +252,19 @@ func deadcode(f *Func) {
b.Values = b.Values[:i]
}
+ // Remove dead blocks from WBLoads list.
+ i = 0
+ for _, b := range f.WBLoads {
+ if reachable[b.ID] {
+ f.WBLoads[i] = b
+ i++
+ }
+ }
+ for j := i; j < len(f.WBLoads); j++ {
+ f.WBLoads[j] = nil
+ }
+ f.WBLoads = f.WBLoads[:i]
+
// Remove unreachable blocks. Return dead blocks to allocator.
i = 0
for _, b := range f.Blocks {