]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: make inlining intrinsics cost one
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 14 Feb 2020 19:42:58 +0000 (11:42 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 27 Feb 2020 20:01:59 +0000 (20:01 +0000)
We were assigning a cost of 2 for intrinsics:
One when we recognized an intrinsic,
and one for the OCALLFUNC node.

I believe that the intent was that intrinsics should
cost 1, since they are typically an arithmetic op,
and because they tend to occur in performance-sensitive code.
(Not that any of this is particularly principled right now.)

Stop charging when we recognize an intrinsic;
let the OCALLFUNC node cover the cost.

This has a negligible impact on std+cmd.

Change-Id: Ie6ae5c18da3ae7e40aec425aed95c6999c2831a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/221357
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/inl.go

index f34193cb321cc5f419cbb3d95ae4368828fa4948..68acf876f8e6cf3304a5bec0d55157ca00ccc2df 100644 (file)
@@ -321,7 +321,7 @@ func (v *hairyVisitor) visit(n *Node) bool {
                }
 
                if isIntrinsicCall(n) {
-                       v.budget--
+                       // Treat like any other node.
                        break
                }