• Daniel Martí's avatar
    cmd/compile: collect reasons in inlining test · 3d741349
    Daniel Martí authored
    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: default avatarMatthew Dempsky <mdempsky@google.com>
    3d741349
inl_test.go 2.74 KB