aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/dom_test.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-03-18 22:00:28 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-03-19 05:37:39 +0000
commita68e5d94fad421e64d471dae1c5ee0b95b933242 (patch)
treed1718f76809e68d4021b5dfb9f6e0922521ffe78 /src/cmd/compile/internal/ssa/dom_test.go
parent62947bedd28a884b46f5df71070a9e86dad17081 (diff)
downloadgo-a68e5d94fad421e64d471dae1c5ee0b95b933242.tar.gz
go-a68e5d94fad421e64d471dae1c5ee0b95b933242.zip
cmd/compile: clean up SSA test API
I noted in CL 38327 that the SSA test API felt a bit clunky after the ssa.Func/ssa.Cache/ssa.Config refactoring, and promised to clean it up once the dust settled. The dust has settled. Along the way, this CL fixes a potential latent bug, in which the amd64 test context was used for all dummy Syslook calls. The lone SSA test using the s390x context did not depend on the Syslook context being correct, so the bug did not arise in practice. Change-Id: If964251d1807976073ad7f47da0b1f1f77c58413 Reviewed-on: https://go-review.googlesource.com/38346 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/dom_test.go')
-rw-r--r--src/cmd/compile/internal/ssa/dom_test.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/cmd/compile/internal/ssa/dom_test.go b/src/cmd/compile/internal/ssa/dom_test.go
index 91758f24db..40f2b35b39 100644
--- a/src/cmd/compile/internal/ssa/dom_test.go
+++ b/src/cmd/compile/internal/ssa/dom_test.go
@@ -161,7 +161,7 @@ var domBenchRes []*Block
func benchmarkDominators(b *testing.B, size int, bg blockGen) {
c := testConfig(b)
- fun := Fun(c, DummyFrontend{b}, "entry", bg(size)...)
+ fun := c.Fun("entry", bg(size)...)
CheckFunc(fun.f)
b.SetBytes(int64(size))
@@ -221,7 +221,7 @@ func verifyDominators(t *testing.T, fut fun, domFn domFunc, doms map[string]stri
func TestDominatorsSingleBlock(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Exit("mem")))
@@ -236,7 +236,7 @@ func TestDominatorsSingleBlock(t *testing.T) {
func TestDominatorsSimple(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Goto("a")),
@@ -264,7 +264,7 @@ func TestDominatorsSimple(t *testing.T) {
func TestDominatorsMultPredFwd(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 1, nil),
@@ -292,7 +292,7 @@ func TestDominatorsMultPredFwd(t *testing.T) {
func TestDominatorsDeadCode(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 0, nil),
@@ -315,7 +315,7 @@ func TestDominatorsDeadCode(t *testing.T) {
func TestDominatorsMultPredRev(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Goto("first")),
Bloc("first",
@@ -346,7 +346,7 @@ func TestDominatorsMultPredRev(t *testing.T) {
func TestDominatorsMultPred(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 1, nil),
@@ -375,7 +375,7 @@ func TestDominatorsMultPred(t *testing.T) {
func TestInfiniteLoop(t *testing.T) {
c := testConfig(t)
// note lack of an exit block
- fun := Fun(c, DummyFrontend{t}, "entry",
+ fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 1, nil),
@@ -411,7 +411,8 @@ func TestDomTricky(t *testing.T) {
b := 1 & i >> 1
c := 1 & i >> 2
- fun := Fun(testConfig(t), DummyFrontend{t}, "1",
+ cfg := testConfig(t)
+ fun := cfg.Fun("1",
Bloc("1",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 1, nil),
@@ -455,7 +456,7 @@ func generateDominatorMap(fut fun) map[string]string {
func TestDominatorsPostTricky(t *testing.T) {
c := testConfig(t)
- fun := Fun(c, DummyFrontend{t}, "b1",
+ fun := c.Fun("b1",
Bloc("b1",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Valu("p", OpConstBool, TypeBool, 1, nil),