]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: constant-fold switches early in compilation
authorKeith Randall <khr@golang.org>
Mon, 7 Feb 2022 07:25:04 +0000 (23:25 -0800)
committerKeith Randall <khr@golang.org>
Thu, 14 Apr 2022 19:37:30 +0000 (19:37 +0000)
commit01b9ae22ed3c0f9c9ea29adbcd23bd97de6d18dd
treed4094cc6e7ae327852ff299b639dc1810391983d
parent1ba96d8c0909eca59e28c048150c3834982f79fb
cmd/compile: constant-fold switches early in compilation

So that the inliner knows all the other cases are dead and doesn't
accumulate any cost for them.

The canonical case for this is switching on runtime.GOOS, which occurs
several places in the stdlib.

Fixes #50253

Change-Id: I44823aaebb6c1b03c9b0c12d10086db81954350f
Reviewed-on: https://go-review.googlesource.com/c/go/+/399694
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/deadcode/deadcode.go
test/inline.go