mirror of
https://github.com/golang/go
synced 2024-11-12 07:00:21 -07:00
[dev.ssa] cmd/compile: identical values are the same pointer
Forgot the obvious case. Allows us to remove the load in: func f(p *int, x int) int { *p = x + 5 return *p } Change-Id: I93686d8240bab3a1d166b88e224cf71e3d947aef Reviewed-on: https://go-review.googlesource.com/19905 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
ed737fd8cd
commit
a5325761cd
@ -204,6 +204,9 @@ func uaddOvf(a, b int64) bool {
|
||||
|
||||
// isSamePtr reports whether p1 and p2 point to the same address.
|
||||
func isSamePtr(p1, p2 *Value) bool {
|
||||
if p1 == p2 {
|
||||
return true
|
||||
}
|
||||
// Aux isn't used in OffPtr, and AuxInt isn't currently used in
|
||||
// Addr, but this still works as the values will be null/0
|
||||
return (p1.Op == OpOffPtr || p1.Op == OpAddr) && p1.Op == p2.Op &&
|
||||
|
Loading…
Reference in New Issue
Block a user