compiler, transform: remove runtime.isnil hack

This hack was originally introduced in
https://github.com/tinygo-org/tinygo/pull/251 to fix an escape analysis
regression after https://github.com/tinygo-org/tinygo/pull/222
introduced nil checks. Since a new optimization in LLVM (see
https://reviews.llvm.org/D60047) this hack is not necessary anymore and
can be removed.

I've compared all regular tests and smoke tests before and after to
check the size. In most cases this change was an improvement although
there are a few regressions.
This commit is contained in:
Ayke van Laethem
2020-03-21 23:00:38 +01:00
committed by Ron Evans
parent bbfa601d27
commit f8876ea245
7 changed files with 13 additions and 72 deletions
-8
View File
@@ -27,14 +27,6 @@ func _recover() interface{} {
return nil
}
// See emitNilCheck in compiler/asserts.go.
// This function is a dummy function that has its first and only parameter
// marked 'nocapture' to work around a limitation in LLVM: a regular pointer
// comparison captures the pointer.
func isnil(ptr *uint8) bool {
return ptr == nil
}
// Panic when trying to dereference a nil pointer.
func nilPanic() {
runtimePanic("nil pointer dereference")