mirror of
https://github.com/golang/go
synced 2024-10-05 18:31:28 -06:00
[dev.ssa] cmd/compile: make sure entry block has no predecessors
Fix one test that build a violating CFG. Change-Id: Ie0296ced602984d914a70461c76559c507ce2510 Reviewed-on: https://go-review.googlesource.com/13621 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
514ab7c385
commit
867662da6a
@ -157,6 +157,10 @@ func checkFunc(f *Func) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(f.Entry.Preds) > 0 {
|
||||
f.Fatalf("entry block %s of %s has predecessor(s) %v", f.Entry, f.Name, f.Entry.Preds)
|
||||
}
|
||||
|
||||
// Check to make sure all Values referenced are in the function.
|
||||
for _, b := range f.Blocks {
|
||||
for _, v := range b.Values {
|
||||
|
@ -317,11 +317,13 @@ func TestDominatorsMultPredRev(t *testing.T) {
|
||||
c := testConfig(t)
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Goto("first")),
|
||||
Bloc("first",
|
||||
Valu("mem", OpArg, TypeMem, 0, ".mem"),
|
||||
Valu("p", OpConstBool, TypeBool, 0, true),
|
||||
Goto("a")),
|
||||
Bloc("a",
|
||||
If("p", "b", "entry")),
|
||||
If("p", "b", "first")),
|
||||
Bloc("b",
|
||||
Goto("c")),
|
||||
Bloc("c",
|
||||
@ -330,7 +332,8 @@ func TestDominatorsMultPredRev(t *testing.T) {
|
||||
Exit("mem")))
|
||||
|
||||
doms := map[string]string{
|
||||
"a": "entry",
|
||||
"first": "entry",
|
||||
"a": "first",
|
||||
"b": "a",
|
||||
"c": "b",
|
||||
"exit": "c",
|
||||
|
Loading…
Reference in New Issue
Block a user