cmd/compile: free value earlier in nilcheck

When we remove a nil check, add it back to the free Value pool immediately.

Fixes #18732

Change-Id: I8d644faabbfb52157d3f2d071150ff0342ac28dc
Reviewed-on: https://go-review.googlesource.com/58810
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Keith Randall 2017-08-24 16:11:44 -07:00
parent 3723d08022
commit 770d8d8207
3 changed files with 6 additions and 3 deletions

View file

@ -1569,7 +1569,7 @@ func (s *regAllocState) regalloc(f *Func) {
if s.f.pass.debug > regDebug {
fmt.Printf("delete copied value %s\n", c.LongString())
}
c.Args[0].Uses--
c.RemoveArg(0)
f.freeValue(c)
delete(s.copies, c)
progress = true