diff options
author | Keith Randall <khr@golang.org> | 2016-02-25 13:45:22 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2016-02-26 04:33:46 +0000 |
commit | 4a346e7489038a0913f590da98a12f6e660b683a (patch) | |
tree | fe206e6aaa226d50aafbb9b724268d9723838674 /test/nilptr3.go | |
parent | d3f15ff6bc353d94b7249f33bb030ee1f7ee887e (diff) | |
download | go-4a346e7489038a0913f590da98a12f6e660b683a.tar.gz go-4a346e7489038a0913f590da98a12f6e660b683a.zip |
[dev.ssa] cmd/compile: get rid of nil checks before float loads/stores
Just like we do for integer loads/stores.
Update #14511
Change-Id: Ic6ca6b54301438a5701ea5fb0be755451cb24d45
Reviewed-on: https://go-review.googlesource.com/19923
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/nilptr3.go')
-rw-r--r-- | test/nilptr3.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/nilptr3.go b/test/nilptr3.go index 1ba774d839..258547733c 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -193,3 +193,21 @@ func f4(x *[10]int) { x = y _ = &x[9] // ERROR "removed repeated nil check" } + +func f5(p *float32, q *float64, r *float32, s *float64) float64 { + x := float64(*p) // ERROR "removed nil check" + y := *q // ERROR "removed nil check" + *r = 7 // ERROR "removed nil check" + *s = 9 // ERROR "removed nil check" + return x + y +} + +type T [29]byte + +func f6(p, q *T) { + x := *p // ERROR "generated nil check" + // On ARM, the nil check on this store gets removed. On other archs, + // it doesn't. Makes this hard to test. SSA will always remove it. + //*q = x + _ = x +} |