Commit 24744f65 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: check that SSA memory args are in the right place

Fixes #15510

Change-Id: I2e0568778ef90cf29712753b8c42109ef84a0256
Reviewed-on: https://go-review.googlesource.com/22784
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 0f84afe2
......@@ -208,10 +208,16 @@ func checkFunc(f *Func) {
f.Fatalf("value %s has an AuxInt value %d but shouldn't", v.LongString(), v.AuxInt)
}
for _, arg := range v.Args {
for i, arg := range v.Args {
if arg == nil {
f.Fatalf("value %s has nil arg", v.LongString())
}
if v.Op != OpPhi {
// For non-Phi ops, memory args must be last, if present
if arg.Type.IsMemory() && i != len(v.Args)-1 {
f.Fatalf("value %s has non-final memory arg (%d < %d)", v.LongString(), i, len(v.Args)-1)
}
}
}
if valueMark[v.ID] {
......
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