1
0
mirror of https://github.com/golang/go synced 2024-09-29 10:24:34 -06:00

reflect: adjust MapRange allocation test for noopt builder, take 2

Change-Id: If2887f84b3d14fac3c059fc5bad4186ec9d69d0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/401077
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Keith Randall 2022-04-19 10:33:46 -07:00
parent 689dc17793
commit aa8262d800

View File

@ -364,6 +364,10 @@ func TestMapIterSet(t *testing.T) {
}
}
if strings.HasSuffix(testenv.Builder(), "-noopt") {
return // no inlining with the noopt builder
}
got := int(testing.AllocsPerRun(10, func() {
iter := v.MapRange()
for iter.Next() {
@ -375,9 +379,6 @@ func TestMapIterSet(t *testing.T) {
// The function is inlineable, so if the local usage does not escape
// the *MapIter, it can remain stack allocated.
want := 0
if strings.HasSuffix(testenv.Builder(), "-noopt") {
want = 1 // no inlining with the noopt builder
}
if got != want {
t.Errorf("wanted %d alloc, got %d", want, got)
}