Skip to content

Commit ddb38c3

Browse files
mdempskygopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Pratt <[email protected]>
1 parent 82fc03f commit ddb38c3

File tree

1 file changed

+1
-10
lines changed
  • src/cmd/compile/internal/devirtualize

1 file changed

+1
-10
lines changed

src/cmd/compile/internal/devirtualize/pgo.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
107107

108108
name := ir.LinkFuncName(fn)
109109

110-
// Can't devirtualize go/defer calls. See comment in Static.
111-
goDeferCall := make(map[*ir.CallExpr]bool)
112-
113110
var jsonW *json.Encoder
114111
if base.Debug.PGODebug >= 3 {
115112
jsonW = json.NewEncoder(os.Stdout)
@@ -121,12 +118,6 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
121118
return n
122119
}
123120

124-
if gds, ok := n.(*ir.GoDeferStmt); ok {
125-
if call, ok := gds.Call.(*ir.CallExpr); ok {
126-
goDeferCall[call] = true
127-
}
128-
}
129-
130121
ir.EditChildren(n, edit)
131122

132123
call, ok := n.(*ir.CallExpr)
@@ -156,7 +147,7 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
156147
fmt.Printf("%v: PGO devirtualize considering call %v\n", ir.Line(call), call)
157148
}
158149

159-
if goDeferCall[call] {
150+
if call.GoDefer {
160151
if base.Debug.PGODebug >= 2 {
161152
fmt.Printf("%v: can't PGO devirtualize go/defer call %v\n", ir.Line(call), call)
162153
}

0 commit comments

Comments
 (0)