cmd/compile/internal/inl: use func-level "never returns" flag

Make use of the "never returns" flag bit in ir.Func when computing
function properties: update the bit when we're done looking at a given
function, and read the bit from imported functions during flag
analysis. The advantage of using the ir.Func flag is that it will get
set (and will propagate through to export data) for all functions,
nost just those that are inline candidates.

Change-Id: I7002364b2c4ff5424ed70748fad87fad1a9e4786
Reviewed-on: https://go-review.googlesource.com/c/go/+/518257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Than McIntosh 2023-08-01 12:04:12 -04:00
parent dab9c502c4
commit eac1f3e461
2 changed files with 2 additions and 1 deletions

View File

@ -76,6 +76,7 @@ func AnalyzeFunc(fn *ir.Func, canInline func(*ir.Func)) *FuncProps {
if err := cstab.merge(fcstab); err != nil {
base.FatalfAt(fn.Pos(), "%v", err)
}
fn.SetNeverReturns(entry.props.Flags&FuncPropNeverReturns != 0)
fpmap[fn] = entry
if fn.Inl != nil && fn.Inl.Properties == "" {
fn.Inl.Properties = entry.props.SerializeToString()

View File

@ -194,7 +194,7 @@ func isExitCall(n ir.Node) bool {
return true
}
}
return false
return name.Func.NeverReturns()
}
// pessimize is called to record the fact that we saw something in the