Skip to content

Commit b0f7be3

Browse files
committed
cmd/compile: don't treat an InlMark as a read during deadstore
An InlMark "read" can't make an otherwise dead store live. Without this CL, we sometimes zero an object twice in succession because we think there is a reader in between. Kind of challenging to make a test for this. The second zeroing has the same instruction on the same line number, so codegen tests can't see it. Fixes #67957 Change-Id: I7fb97ebff50d8eb6246fc4802d1136b7cc76c45f Reviewed-on: https://go-review.googlesource.com/c/go/+/592615 Reviewed-by: David Chase <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent f66db49 commit b0f7be3

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/cmd/compile/internal/ssa/deadstore.go

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ func dse(f *Func) {
5959
continue
6060
}
6161
}
62+
if v.Op == OpInlMark {
63+
// Not really a use of the memory. See #67957.
64+
continue
65+
}
6266
for _, a := range v.Args {
6367
if a.Block == b && a.Type.IsMemory() {
6468
loadUse.add(a.ID)

src/runtime/symtabinl_test.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,17 @@ func lineNumber() int {
107107
// Below here is the test data for XTestInlineUnwinder
108108

109109
var tiuStart = lineNumber() // +0
110-
var tiu1, tiu2, tiu3 int // +1
111-
func tiuInlined1() { // +2
112-
tiu1++ // +3
110+
var tiu2, tiu3 int // +1
111+
func tiuInlined1(i int) { // +2
112+
tiu1[i]++ // +3
113113
} // +4
114114
func tiuInlined2() { // +5
115-
tiuInlined1() // +6
116-
tiu2++ // +7
115+
tiuInlined1(1) // +6
116+
tiu2++ // +7
117117
} // +8
118118
func tiuTest() { // +9
119-
tiuInlined1() // +10
120-
tiuInlined2() // +11
121-
tiu3++ // +12
122-
} // +13
119+
tiuInlined1(0) // +10
120+
tiuInlined2() // +11
121+
tiu3++ // +12
122+
} // +13
123+
var tiu1 [2]int // +14

0 commit comments

Comments
 (0)