1
0
mirror of https://github.com/golang/go synced 2024-10-05 20:31:20 -06:00

[dev.ssa] cmd/compile: schedule phi control values first

Change-Id: I684440dc316625d5572cc12179adbc206e306429
Reviewed-on: https://go-review.googlesource.com/13263
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-08-05 16:07:13 -07:00
parent cd0cb0a9d6
commit f1401f1a10

View File

@ -15,7 +15,7 @@ func schedule(f *Func) {
uses := make([]int, f.NumValues()) uses := make([]int, f.NumValues())
// "priority" for a value // "priority" for a value
score := make([]int, f.NumValues()) score := make([]uint8, f.NumValues())
// scheduling order. We queue values in this list in reverse order. // scheduling order. We queue values in this list in reverse order.
var order []*Value var order []*Value
@ -57,8 +57,9 @@ func schedule(f *Func) {
score[v.ID] = 1 score[v.ID] = 1
} }
} }
if b.Control != nil { if b.Control != nil && b.Control.Op != OpPhi {
// Force the control value to be scheduled at the end. // Force the control value to be scheduled at the end,
// unless it is a phi value (which must be first).
score[b.Control.ID] = 3 score[b.Control.ID] = 3
// TODO: some times control values are used by other values // TODO: some times control values are used by other values
// in the block. So the control value will not appear at // in the block. So the control value will not appear at