cmd/compile/internal/inline: refactor fixpoint algorithm

This CL refactors the interleaved fixpoint algorithm so that calls can
be inlined in any order. This has no immediate effect, but it will
allow a subsequent CL to prioritize calls by inlheur score.

Change-Id: I11a84d228e9c94732ee75f0d3c99bc90d83fea09
Reviewed-on: https://go-review.googlesource.com/c/go/+/567695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Matthew Dempsky 2024-02-28 01:28:43 -08:00 committed by Gopher Robot
parent f4602288ef
commit 28e0052ee7
2 changed files with 107 additions and 32 deletions

View file

@ -856,13 +856,19 @@ func IsAddressable(n Node) bool {
// "g()" expression.
func StaticValue(n Node) Node {
for {
if n.Op() == OCONVNOP {
n = n.(*ConvExpr).X
continue
}
if n.Op() == OINLCALL {
n = n.(*InlinedCallExpr).SingleResult()
switch n1 := n.(type) {
case *ConvExpr:
if n1.Op() == OCONVNOP {
n = n1.X
continue
}
case *InlinedCallExpr:
if n1.Op() == OINLCALL {
n = n1.SingleResult()
continue
}
case *ParenExpr:
n = n1.X
continue
}