cmd/compile: get rid of unnecessary inline marks

If no other instruction mentions an inline mark, we can get rid of it.
This normally happens when the inlined function is empty, or when all
of its code is folded into other instructions.

Also use consistent statement-ness for inline mark positions, so that
more of them can be removed in favor of existing instructions.

Update #29571
Fixes #31172

Change-Id: I71f84d355101f37a27960d9e8528f42f92767496
Reviewed-on: https://go-review.googlesource.com/c/go/+/170445
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Keith Randall 2019-04-02 15:00:54 -07:00 committed by Keith Randall
parent 7bb8fc1033
commit c46ebec322
2 changed files with 32 additions and 1 deletions

View file

@ -1054,7 +1054,7 @@ func mkinlcall(n, fn *Node, maxCost int32) *Node {
// to put a breakpoint. Not sure if that's really necessary or not
// (in which case it could go at the end of the function instead).
inlMark := nod(OINLMARK, nil, nil)
inlMark.Pos = n.Pos
inlMark.Pos = n.Pos.WithDefaultStmt()
inlMark.Xoffset = int64(newIndex)
ninit.Append(inlMark)