]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: preempt repeated checks for the zero constant in prove
authorzdjones <zachj1@gmail.com>
Fri, 29 Mar 2019 19:17:35 +0000 (19:17 +0000)
committerGiovanni Bajo <rasky@develer.com>
Fri, 29 Mar 2019 23:05:45 +0000 (23:05 +0000)
commit576442b27bae5009ad7582d5175caadf29f7bf5b
tree234032c8bbef3d3326ecd8fe2d688065f4f11016
parentee780d4a780be9d8517583bb7c3598c834b6f775
cmd/compile: preempt repeated checks for the zero constant in prove

Prove requires access to a zero-valued constant in multiple heavily-used
code paths. Currently, prove is checking for the existence of the constant on
every iteration of these paths, and creating it if not found.

This CL preempts all of these checks by finding or creating the zero constant
Value, just once, when the factsTable is initialised on entry to prove(). The
Method used to initialise the zero constant, func.ConstInt64(), finds an
existing constant if present, or creates one in the entry block otherwise.

Fixes #31141

Change-Id: Ic9a2fd9d79b67025e24d4483f6e87cf8213ead24
Reviewed-on: https://go-review.googlesource.com/c/go/+/170118
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/prove.go