• zdjones's avatar
    cmd/compile: preempt repeated checks for the zero constant in prove · 576442b2
    zdjones authored
    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/+/170118Reviewed-by: default avatarGiovanni Bajo <rasky@develer.com>
    Run-TryBot: Giovanni Bajo <rasky@develer.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    576442b2
prove.go 34.1 KB