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

[dev.ssa] cmd/compile: enforce that all phis are first during regalloc

Change-Id: I035708f5d0659b3deef00808d35e1cc8a80215e0
Reviewed-on: https://go-review.googlesource.com/13243Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent f1401f1a
......@@ -394,11 +394,16 @@ func regalloc(f *Func) {
// immediately preceding the phi's block.
func addPhiCopies(f *Func) {
for _, b := range f.Blocks {
phis := true // all phis should appear first; confirm that as we go
for _, v := range b.Values {
if v.Op != OpPhi {
break // all phis should appear first
}
if v.Type.IsMemory() { // TODO: only "regallocable" types
switch {
case v.Op == OpPhi && !phis:
f.Fatalf("phi var %v not at beginning of block %v:\n%s\n", v, v.Block, f)
break
case v.Op != OpPhi:
phis = false
continue
case v.Type.IsMemory(): // TODO: only "regallocable" types
continue
}
for i, w := range v.Args {
......
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