]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/inl: use func-level "never returns" flag
authorThan McIntosh <thanm@google.com>
Tue, 1 Aug 2023 16:04:12 +0000 (12:04 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 15 Sep 2023 12:45:33 +0000 (12:45 +0000)
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>
src/cmd/compile/internal/inline/inlheur/analyze.go
src/cmd/compile/internal/inline/inlheur/analyze_func_flags.go

index 78a6cc5325fd0a30579b93ce30d6a586fc21bc10..325063fed5833a22984cf4ebdf248098e85f65c9 100644 (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()
index 463fa36a69000f0f78f1717d823a7a85444073a2..15f5bd5f3574c4cb63850f40f19aebec79b2362d 100644 (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