Skip to content

Commit 0825475

Browse files
fengyoulinrandall77
authored andcommitted
cmd/compile: do not treat OpLocalAddr as load in DSE
Fixes #70409 Fixes #47107 Change-Id: I82a66c46f6b76c68e156b5d937273b0316975d44 Reviewed-on: https://go-review.googlesource.com/c/go/+/629016 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 5cb5437 commit 0825475

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ func dse(f *Func) {
5252
if v.Op == OpLocalAddr {
5353
if _, ok := localAddrs[v.Aux]; !ok {
5454
localAddrs[v.Aux] = v
55-
} else {
56-
continue
5755
}
56+
continue
5857
}
5958
if v.Op == OpInlMark {
6059
// Not really a use of the memory. See #67957.

test/codegen/issue70409.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// asmcheck -gcflags=-d=ssa/check/on
2+
3+
// Copyright 2024 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package codegen
8+
9+
// amd64:-"MOVQ"
10+
func foo(v uint64) (b [8]byte) {
11+
b[0] = byte(v)
12+
b[1] = byte(v >> 8)
13+
b[2] = byte(v >> 16)
14+
b[3] = byte(v >> 24)
15+
b[4] = byte(v >> 32)
16+
b[5] = byte(v >> 40)
17+
b[6] = byte(v >> 48)
18+
b[7] = byte(v >> 56)
19+
return b
20+
}

0 commit comments

Comments
 (0)