From: Josh Bleecher Snyder Date: Wed, 4 May 2016 18:43:42 +0000 (-0700) Subject: cmd/compile: check that SSA memory args are in the right place X-Git-Tag: go1.7beta1~337 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=24744f6561f3ff7bc58046ba62abbc1c07e9fd4e;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/check.go b/src/cmd/compile/internal/ssa/check.go index 457bf639db..d77b912041 100644 --- a/src/cmd/compile/internal/ssa/check.go +++ b/src/cmd/compile/internal/ssa/check.go @@ -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] {