cmd/compile: do not inline functions marked cgo_unsafe_args

Now the net tests pass with -gcflags '-l=4'.

Fixes #18125.

Change-Id: I4e3a46eb0cb3a93b203e74f5bc99c5822331f535
Reviewed-on: https://go-review.googlesource.com/33722
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
David Lazar 2016-11-30 17:09:07 -05:00
parent 3c2e4ed8d3
commit 9fbfe7cca0
1 changed files with 6 additions and 0 deletions

View File

@ -107,6 +107,12 @@ func caninl(fn *Node) {
return
}
// If marked "go:cgo_unsafe_args", don't inline
if fn.Func.Pragma&CgoUnsafeArgs != 0 {
reason = "marked go:cgo_unsafe_args"
return
}
// If fn has no body (is defined outside of Go), cannot inline it.
if fn.Nbody.Len() == 0 {
reason = "no function body"