]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: collect reasons in inlining test
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 14 Sep 2017 14:51:18 +0000 (15:51 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 22 Sep 2017 10:59:14 +0000 (10:59 +0000)
commit3d741349f5c7bf198a1c85acd374d1bee215f30e
treeecb26dd69e51294386098baafdac93634a6ae0af
parent7a5d76fa62d05a97d088a1278508d3c868cab4a2
cmd/compile: collect reasons in inlining test

If we use -gcflags='-m -m', the compiler should give us a reason why a
func couldn't be inlined. Add the extra -m necessary for that extra info
and use it to give better test failures. For example, for the func in
the TODO:

--- FAIL: TestIntendedInlining (1.53s)
inl_test.go:104: runtime.nextFreeFast was not inlined: function too complex

We might increase the number of -m flags to get more information at some
later point, such as getting details on how close the func was to the
inlining budget.

Also started using regexes, as the output parsing is getting a bit too
complex for manual string handling.

While at it, also refactored the test to not buffer the entire output
into memory. This is fine in practice, but it won't scale well as we add
more packages or we depend more on the compiler's debugging output.

For example, "go build -a -gcflags='-m -m' std" prints nearly 40MB of
plaintext - and we only need to see the output line by line anyway.

Updates #21851.

Change-Id: I00986ff360eb56e4e9737b65a6be749ef8540643
Reviewed-on: https://go-review.googlesource.com/63810
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/inl_test.go