Commit f1401f1a authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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

Change-Id: I684440dc316625d5572cc12179adbc206e306429
Reviewed-on: https://go-review.googlesource.com/13263Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent cd0cb0a9
...@@ -15,7 +15,7 @@ func schedule(f *Func) { ...@@ -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) { ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment