func TestFuseEliminatesOneBranch(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
func TestFuseEliminatesBothBranches(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
func TestFuseHandlesPhis(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
}
func TestFuseEliminatesEmptyBlocks(t *testing.T) {
- c := NewConfig("amd64", nil, true)
+ c := testConfig(t)
fun := Fun(c, DummyFrontend{t}, "entry",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
Bloc("exit", Exit("mem")),
)
- c := NewConfig("amd64", nil, true)
+ c := testConfig(b)
fun := Fun(c, DummyFrontend{b}, "entry", blocs...)
CheckFunc(fun.f)
// TestNilcheckSimple verifies that a second repeated nilcheck is removed.
func TestNilcheckSimple(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// on the order of the dominees.
func TestNilcheckDomOrder(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// TestNilcheckAddr verifies that nilchecks of OpAddr constructed values are removed.
func TestNilcheckAddr(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// TestNilcheckAddPtr verifies that nilchecks of OpAddPtr constructed values are removed.
func TestNilcheckAddPtr(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// non-nil are removed.
func TestNilcheckPhi(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// are removed, but checks of different pointers are not.
func TestNilcheckKeepRemove(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// block are *not* removed.
func TestNilcheckInFalseBranch(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// wil remove the generated nil check.
func TestNilcheckUser(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),
// TestNilcheckBug reproduces a bug in nilcheckelim found by compiling math/big
func TestNilcheckBug(t *testing.T) {
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",
Bloc("entry",
Valu("mem", OpInitMem, TypeMem, 0, nil),