Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/compile: runtime check for availability of popcount is spammy #30946
What version of Go are you using (
Unfortunately, the compiler doesn't know that the global being checked is unchanging.
Duplicating the loop would be harder. The compiler doesn't have the facility for optimizations like that at the moment.
It might be a cool feature to have a way to express that, like
which could contain enough compiler hint that the compiler could omit such runtime checks. Although it'd look really silly to just write the exact same loop on both sides of an if. :)