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

cmd/compile: use testConfig consistently in SSA tests

Change-Id: Iae41e14ee55eb4068fcb2189a77b345a7c5468b4
Reviewed-on: https://go-review.googlesource.com/38333
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 3928e847
...@@ -160,7 +160,7 @@ func genMaxPredValue(size int) []bloc { ...@@ -160,7 +160,7 @@ func genMaxPredValue(size int) []bloc {
var domBenchRes []*Block var domBenchRes []*Block
func benchmarkDominators(b *testing.B, size int, bg blockGen) { func benchmarkDominators(b *testing.B, size int, bg blockGen) {
c := NewConfig("amd64", nil, true) c := testConfig(b)
fun := Fun(c, DummyFrontend{b}, "entry", bg(size)...) fun := Fun(c, DummyFrontend{b}, "entry", bg(size)...)
CheckFunc(fun.f) CheckFunc(fun.f)
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
func TestFuseEliminatesOneBranch(t *testing.T) { func TestFuseEliminatesOneBranch(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -36,7 +36,7 @@ func TestFuseEliminatesOneBranch(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestFuseEliminatesOneBranch(t *testing.T) {
func TestFuseEliminatesBothBranches(t *testing.T) { func TestFuseEliminatesBothBranches(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -69,7 +69,7 @@ func TestFuseEliminatesBothBranches(t *testing.T) { ...@@ -69,7 +69,7 @@ func TestFuseEliminatesBothBranches(t *testing.T) {
func TestFuseHandlesPhis(t *testing.T) { func TestFuseHandlesPhis(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -102,7 +102,7 @@ func TestFuseHandlesPhis(t *testing.T) { ...@@ -102,7 +102,7 @@ func TestFuseHandlesPhis(t *testing.T) {
} }
func TestFuseEliminatesEmptyBlocks(t *testing.T) { func TestFuseEliminatesEmptyBlocks(t *testing.T) {
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
......
...@@ -22,7 +22,7 @@ func lcaEqual(f *Func, lca1, lca2 lca) bool { ...@@ -22,7 +22,7 @@ func lcaEqual(f *Func, lca1, lca2 lca) bool {
} }
func testLCAgen(t *testing.T, bg blockGen, size int) { func testLCAgen(t *testing.T, bg blockGen, size int) {
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", bg(size)...) fun := Fun(c, DummyFrontend{t}, "entry", bg(size)...)
CheckFunc(fun.f) CheckFunc(fun.f)
if size == 4 { if size == 4 {
......
...@@ -40,7 +40,7 @@ func benchmarkNilCheckDeep(b *testing.B, depth int) { ...@@ -40,7 +40,7 @@ func benchmarkNilCheckDeep(b *testing.B, depth int) {
Bloc("exit", Exit("mem")), Bloc("exit", Exit("mem")),
) )
c := NewConfig("amd64", nil, true) c := testConfig(b)
fun := Fun(c, DummyFrontend{b}, "entry", blocs...) fun := Fun(c, DummyFrontend{b}, "entry", blocs...)
CheckFunc(fun.f) CheckFunc(fun.f)
...@@ -64,7 +64,7 @@ func isNilCheck(b *Block) bool { ...@@ -64,7 +64,7 @@ func isNilCheck(b *Block) bool {
// TestNilcheckSimple verifies that a second repeated nilcheck is removed. // TestNilcheckSimple verifies that a second repeated nilcheck is removed.
func TestNilcheckSimple(t *testing.T) { func TestNilcheckSimple(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -101,7 +101,7 @@ func TestNilcheckSimple(t *testing.T) { ...@@ -101,7 +101,7 @@ func TestNilcheckSimple(t *testing.T) {
// on the order of the dominees. // on the order of the dominees.
func TestNilcheckDomOrder(t *testing.T) { func TestNilcheckDomOrder(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -137,7 +137,7 @@ func TestNilcheckDomOrder(t *testing.T) { ...@@ -137,7 +137,7 @@ func TestNilcheckDomOrder(t *testing.T) {
// TestNilcheckAddr verifies that nilchecks of OpAddr constructed values are removed. // TestNilcheckAddr verifies that nilchecks of OpAddr constructed values are removed.
func TestNilcheckAddr(t *testing.T) { func TestNilcheckAddr(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -170,7 +170,7 @@ func TestNilcheckAddr(t *testing.T) { ...@@ -170,7 +170,7 @@ func TestNilcheckAddr(t *testing.T) {
// TestNilcheckAddPtr verifies that nilchecks of OpAddPtr constructed values are removed. // TestNilcheckAddPtr verifies that nilchecks of OpAddPtr constructed values are removed.
func TestNilcheckAddPtr(t *testing.T) { func TestNilcheckAddPtr(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -205,7 +205,7 @@ func TestNilcheckAddPtr(t *testing.T) { ...@@ -205,7 +205,7 @@ func TestNilcheckAddPtr(t *testing.T) {
// non-nil are removed. // non-nil are removed.
func TestNilcheckPhi(t *testing.T) { func TestNilcheckPhi(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -249,7 +249,7 @@ func TestNilcheckPhi(t *testing.T) { ...@@ -249,7 +249,7 @@ func TestNilcheckPhi(t *testing.T) {
// are removed, but checks of different pointers are not. // are removed, but checks of different pointers are not.
func TestNilcheckKeepRemove(t *testing.T) { func TestNilcheckKeepRemove(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -297,7 +297,7 @@ func TestNilcheckKeepRemove(t *testing.T) { ...@@ -297,7 +297,7 @@ func TestNilcheckKeepRemove(t *testing.T) {
// block are *not* removed. // block are *not* removed.
func TestNilcheckInFalseBranch(t *testing.T) { func TestNilcheckInFalseBranch(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -348,7 +348,7 @@ func TestNilcheckInFalseBranch(t *testing.T) { ...@@ -348,7 +348,7 @@ func TestNilcheckInFalseBranch(t *testing.T) {
// wil remove the generated nil check. // wil remove the generated nil check.
func TestNilcheckUser(t *testing.T) { func TestNilcheckUser(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
...@@ -387,7 +387,7 @@ func TestNilcheckUser(t *testing.T) { ...@@ -387,7 +387,7 @@ func TestNilcheckUser(t *testing.T) {
// TestNilcheckBug reproduces a bug in nilcheckelim found by compiling math/big // TestNilcheckBug reproduces a bug in nilcheckelim found by compiling math/big
func TestNilcheckBug(t *testing.T) { func TestNilcheckBug(t *testing.T) {
ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing
c := NewConfig("amd64", nil, true) c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry", fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("mem", OpInitMem, TypeMem, 0, nil),
......
...@@ -33,7 +33,7 @@ func BenchmarkMultiPassBlock(b *testing.B) { benchFnBlock(b, multi, genFunction) ...@@ -33,7 +33,7 @@ func BenchmarkMultiPassBlock(b *testing.B) { benchFnBlock(b, multi, genFunction)
// benchFnPass runs passFunc b.N times across a single function. // benchFnPass runs passFunc b.N times across a single function.
func benchFnPass(b *testing.B, fn passFunc, size int, bg blockGen) { func benchFnPass(b *testing.B, fn passFunc, size int, bg blockGen) {
b.ReportAllocs() b.ReportAllocs()
c := NewConfig("amd64", nil, true) c := testConfig(b)
fun := Fun(c, DummyFrontend{b}, "entry", bg(size)...) fun := Fun(c, DummyFrontend{b}, "entry", bg(size)...)
CheckFunc(fun.f) CheckFunc(fun.f)
b.ResetTimer() b.ResetTimer()
...@@ -48,7 +48,7 @@ func benchFnPass(b *testing.B, fn passFunc, size int, bg blockGen) { ...@@ -48,7 +48,7 @@ func benchFnPass(b *testing.B, fn passFunc, size int, bg blockGen) {
// benchFnPass runs passFunc across a function with b.N blocks. // benchFnPass runs passFunc across a function with b.N blocks.
func benchFnBlock(b *testing.B, fn passFunc, bg blockGen) { func benchFnBlock(b *testing.B, fn passFunc, bg blockGen) {
b.ReportAllocs() b.ReportAllocs()
c := NewConfig("amd64", nil, true) c := testConfig(b)
fun := Fun(c, DummyFrontend{b}, "entry", bg(b.N)...) fun := Fun(c, DummyFrontend{b}, "entry", bg(b.N)...)
CheckFunc(fun.f) CheckFunc(fun.f)
b.ResetTimer() b.ResetTimer()
......
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