func BenchmarkNilCheckDeep1(b *testing.B) { … } func BenchmarkNilCheckDeep10(b *testing.B) { … } func BenchmarkNilCheckDeep100(b *testing.B) { … } func BenchmarkNilCheckDeep1000(b *testing.B) { … } func BenchmarkNilCheckDeep10000(b *testing.B) { … } // benchmarkNilCheckDeep is a stress test of nilcheckelim. // It uses the worst possible input: A linear string of // nil checks, none of which can be eliminated. // Run with multiple depths to observe big-O behavior. func benchmarkNilCheckDeep(b *testing.B, depth int) { … } func blockn(n int) string { … } func ptrn(n int) string { … } func booln(n int) string { … } func isNilCheck(b *Block) bool { … } // TestNilcheckSimple verifies that a second repeated nilcheck is removed. func TestNilcheckSimple(t *testing.T) { … } // TestNilcheckDomOrder ensures that the nil check elimination isn't dependent // on the order of the dominees. func TestNilcheckDomOrder(t *testing.T) { … } // TestNilcheckAddr verifies that nilchecks of OpAddr constructed values are removed. func TestNilcheckAddr(t *testing.T) { … } // TestNilcheckAddPtr verifies that nilchecks of OpAddPtr constructed values are removed. func TestNilcheckAddPtr(t *testing.T) { … } // TestNilcheckPhi tests that nil checks of phis, for which all values are known to be // non-nil are removed. func TestNilcheckPhi(t *testing.T) { … } // TestNilcheckKeepRemove verifies that duplicate checks of the same pointer // are removed, but checks of different pointers are not. func TestNilcheckKeepRemove(t *testing.T) { … } // TestNilcheckInFalseBranch tests that nil checks in the false branch of a nilcheck // block are *not* removed. func TestNilcheckInFalseBranch(t *testing.T) { … } // TestNilcheckUser verifies that a user nil check that dominates a generated nil check // wil remove the generated nil check. func TestNilcheckUser(t *testing.T) { … } // TestNilcheckBug reproduces a bug in nilcheckelim found by compiling math/big func TestNilcheckBug(t *testing.T) { … }