]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid copying in nilcheckelim2
authorMarvin Stenger <marvin.stenger94@gmail.com>
Fri, 22 Sep 2017 23:20:12 +0000 (01:20 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 29 Sep 2017 09:27:14 +0000 (09:27 +0000)
commitbad5abf64d76f9c302c084c5f62e6f70920d3c81
treee9f61f4a7f2c475a70d692fa95d2b982e7eeb39d
parentd8efa0e0ed8bbd5ed0780527652d86be2fba99dc
cmd/compile: avoid copying in nilcheckelim2

nilcheckelim2 cleans up by copying b.Values in a loop, omitting
OpUnknowns. However, the common case is that there are no OpUnknowns,
in which case we can skip a lot of work.

So we track the first nilcheck which was eliminated, if any, and only
start copying from there. If no nilcheck was eliminated we won't copy at all.

Fixes #20964

Change-Id: Icd44194cf8ac81ce6485ce257b4d33e093003a40
Reviewed-on: https://go-review.googlesource.com/65651
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/nilcheck.go