You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiling it with default optimization options correctly inlines the call to the empty function f() but its argument, even if not "consumed" by anything in the inlined call to f() is still computed. I was expecting a deeper optimization level correctly seeing that these rvalues are not used at all when f() is empty.
Here are the output of gc using the -S flag with and without inlining to highlight the fact that the computation of the arguments are still here whether the inlining results in a noop or not.
go version
)?go version go1.6 linux/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
Given this example:
https://play.golang.org/p/LqaVgTCP57
Compiling it with default optimization options correctly inlines the call to the empty function
f()
but its argument, even if not "consumed" by anything in the inlined call tof()
is still computed. I was expecting a deeper optimization level correctly seeing that these rvalues are not used at all whenf()
is empty.Here are the output of gc using the
-S
flag with and without inlining to highlight the fact that the computation of the arguments are still here whether the inlining results in a noop or not.The data-flow analyser should be able to delete useless arguments (and associated computations).
Useless instructions.
The text was updated successfully, but these errors were encountered: