Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: SSA compiler removes code in benchmarks #14813
This code is a simple benchmark of Hamming weight algorithms: http://play.golang.org/p/kOid3lX9Yz
In Go 1.6 running
But on tip with SSA turned on it's
Same goes for running with
You are not using the value from popcnt2, and because the function was inlined, the compiler can see the value is unused, so it removed the call entirely.
Here is something I wrote about writing a reliable benchmark, http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go, hopefully it will be of use.
I am going to close this as this is not a bug. For general Go questions see https://golang.org/wiki/Questions. Thanks!
Huh, I've seen the
Using the top-level result variable solves the problem. I guess it's kind of a documentation issue. Either way, thank you as well.
I've found a few cases of
Could the problem be solved with something similar to
No, no more magical //go:XXX comments please.
It's beginning to sound like gcc's attribute,