mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/escape: stop disabling literal allocation optimizations when coverage is enabled
CL 649079 and CL 649035 updated escape analysis to rewrite certain expressions in OMAKE and OCONVIFACE nodes as optimizations to reduce user allocations. Part of the change in CL 649079 disabled those optimzations when coverage instrumentation was enabled under an incorrect possible theory of how those optimizations might be "expected" to change coverage results -- in particular, the cover_build_pkg_select.txt testscript failed with different coverage results. I now realize that the proper explanation is that my fix in CL 684116 was needed. Now that CL 684116 is merged, we should no longer disable these optimizations when coverage is enabled, which is what this CL does. This has not been reported as a problem to my knowledge, but without this CL, one could imagine for example a test using testing.AllocsPerRun might start failing when coverage was enabled if the result relied on these optimizations. As expected, if we place this CL just before the necessary fix in CL 684116, the cover_build_pkg_select.txt testscript fails with a changed coverage result. If we place this CL just after CL 684116, the test passes, also as expected. Updates #71359 Change-Id: Ib5ff00c267acd85dd423c238d177e91a4d881f9e Reviewed-on: https://go-review.googlesource.com/c/go/+/684777 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
8002d283e8
commit
479b51ee1f
1 changed files with 0 additions and 4 deletions
|
|
@ -534,10 +534,6 @@ func (b *batch) rewriteWithLiterals(n ir.Node, fn *ir.Func) {
|
|||
if n.Op() != ir.OMAKESLICE && n.Op() != ir.OCONVIFACE {
|
||||
return
|
||||
}
|
||||
if base.Flag.Cfg.CoverageInfo != nil {
|
||||
// Avoid altering coverage results.
|
||||
return
|
||||
}
|
||||
|
||||
// Look up a cached ReassignOracle for the function, lazily computing one if needed.
|
||||
ro := b.reassignOracle(fn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue