diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 017bc25e460..513d2678f66 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -460,10 +460,10 @@ opSwitch: case "panicrangestate": cheap = true } - // Special case for reflect.noescape. It does just type + // Special case for internal/abi.NoEscape. It does just type // conversions to appease the escape analysis, and doesn't // generate code. - if types.ReflectSymName(name.Sym()) == "noescape" { + if s := name.Sym(); s.Name == "NoEscape" && s.Pkg.Path == "internal/abi" { cheap = true } } diff --git a/src/reflect/value.go b/src/reflect/value.go index 0854371ed41..8df7d13114d 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -2677,7 +2677,7 @@ func (v Value) TrySend(x Value) bool { // Type returns v's type. func (v Value) Type() Type { if v.flag != 0 && v.flag&flagMethod == 0 { - return (*rtype)(noescape(unsafe.Pointer(v.typ_))) // inline of toRType(v.typ()), for own inlining in inline test + return (*rtype)(abi.NoEscape(unsafe.Pointer(v.typ_))) // inline of toRType(v.typ()), for own inlining in inline test } return v.typeSlow() } @@ -4018,13 +4018,3 @@ func contentEscapes(x unsafe.Pointer) { escapes(*(*any)(x)) // the dereference may not always be safe, but never executed } } - -// This is just a wrapper around abi.NoEscape. The inlining heuristics are -// finnicky and for whatever reason treat the local call to noescape as much -// lower cost with respect to the inliner budget. (That is, replacing calls to -// noescape with abi.NoEscape will cause inlining tests to fail.) -// -//go:nosplit -func noescape(p unsafe.Pointer) unsafe.Pointer { - return abi.NoEscape(p) -}