aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index a7fd704b85..14adbf5d43 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -37,6 +37,7 @@ import (
"cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
"cmd/internal/obj"
+ "cmd/internal/objabi"
"cmd/internal/src"
)
@@ -471,6 +472,28 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
}
}
}
+
+ case ir.OAS:
+ // Special case for coverage counter updates and coverage
+ // function registrations. Although these correspond to real
+ // operations, we treat them as zero cost for the moment. This
+ // is primarily due to the existence of tests that are
+ // sensitive to inlining-- if the insertion of coverage
+ // instrumentation happens to tip a given function over the
+ // threshold and move it from "inlinable" to "not-inlinable",
+ // this can cause changes in allocation behavior, which can
+ // then result in test failures (a good example is the
+ // TestAllocations in crypto/ed25519).
+ n := n.(*ir.AssignStmt)
+ if n.X.Op() == ir.OINDEX {
+ n := n.X.(*ir.IndexExpr)
+ if n.X.Op() == ir.ONAME && n.X.Type().IsArray() {
+ n := n.X.(*ir.Name)
+ if n.Linksym().Type == objabi.SCOVERAGE_COUNTER {
+ return false
+ }
+ }
+ }
}
v.budget--