mirror of
https://github.com/golang/go.git
synced 2025-05-28 02:41:30 +00:00
cmd/compile/internal/devirtualize: use CallExpr.GoDefer for PGO
CL 543657 dedup'd the go/defer statement recognition between the inliner and static devirtualizer. This CL extends that for PGO-based devirtualization too. Change-Id: I998753132af1ef17329676f4e17515f16e0acb03 Reviewed-on: https://go-review.googlesource.com/c/go/+/543775 Auto-Submit: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
82fc03f9c9
commit
ddb38c3f54
@ -107,9 +107,6 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
|
||||
|
||||
name := ir.LinkFuncName(fn)
|
||||
|
||||
// Can't devirtualize go/defer calls. See comment in Static.
|
||||
goDeferCall := make(map[*ir.CallExpr]bool)
|
||||
|
||||
var jsonW *json.Encoder
|
||||
if base.Debug.PGODebug >= 3 {
|
||||
jsonW = json.NewEncoder(os.Stdout)
|
||||
@ -121,12 +118,6 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
|
||||
return n
|
||||
}
|
||||
|
||||
if gds, ok := n.(*ir.GoDeferStmt); ok {
|
||||
if call, ok := gds.Call.(*ir.CallExpr); ok {
|
||||
goDeferCall[call] = true
|
||||
}
|
||||
}
|
||||
|
||||
ir.EditChildren(n, edit)
|
||||
|
||||
call, ok := n.(*ir.CallExpr)
|
||||
@ -156,7 +147,7 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
|
||||
fmt.Printf("%v: PGO devirtualize considering call %v\n", ir.Line(call), call)
|
||||
}
|
||||
|
||||
if goDeferCall[call] {
|
||||
if call.GoDefer {
|
||||
if base.Debug.PGODebug >= 2 {
|
||||
fmt.Printf("%v: can't PGO devirtualize go/defer call %v\n", ir.Line(call), call)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user