mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
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:
committed by
Ron Evans
parent
bbfa601d27
commit
f8876ea245
Vendored
+4
-8
@@ -19,8 +19,6 @@ declare void @"internal/task.start"(i32, i8*, i8*, i8*)
|
||||
|
||||
declare void @runtime.nilPanic(i8*, i8*)
|
||||
|
||||
declare i1 @runtime.isnil(i8*, i8*, i8*)
|
||||
|
||||
declare void @"main$1"(i32, i8*, i8*)
|
||||
|
||||
declare void @"main$2"(i32, i8*, i8*)
|
||||
@@ -38,9 +36,8 @@ define void @runFunc1(i8*, i32, i8, i8* %context, i8* %parentHandle) {
|
||||
entry:
|
||||
%3 = call i32 @runtime.getFuncPtr(i8* %0, i32 %1, %runtime.typecodeID* @"reflect/types.type:func:{basic:int8}{}", i8* undef, i8* null)
|
||||
%4 = inttoptr i32 %3 to void (i8, i8*, i8*)*
|
||||
%5 = bitcast void (i8, i8*, i8*)* %4 to i8*
|
||||
%6 = call i1 @runtime.isnil(i8* %5, i8* undef, i8* null)
|
||||
br i1 %6, label %fpcall.nil, label %fpcall.next
|
||||
%5 = icmp eq void (i8, i8*, i8*)* %4, null
|
||||
br i1 %5, label %fpcall.nil, label %fpcall.next
|
||||
|
||||
fpcall.nil:
|
||||
call void @runtime.nilPanic(i8* undef, i8* null)
|
||||
@@ -58,9 +55,8 @@ define void @runFunc2(i8*, i32, i8, i8* %context, i8* %parentHandle) {
|
||||
entry:
|
||||
%3 = call i32 @runtime.getFuncPtr(i8* %0, i32 %1, %runtime.typecodeID* @"reflect/types.type:func:{basic:uint8}{}", i8* undef, i8* null)
|
||||
%4 = inttoptr i32 %3 to void (i8, i8*, i8*)*
|
||||
%5 = bitcast void (i8, i8*, i8*)* %4 to i8*
|
||||
%6 = call i1 @runtime.isnil(i8* %5, i8* undef, i8* null)
|
||||
br i1 %6, label %fpcall.nil, label %fpcall.next
|
||||
%5 = icmp eq void (i8, i8*, i8*)* %4, null
|
||||
br i1 %5, label %fpcall.nil, label %fpcall.next
|
||||
|
||||
fpcall.nil:
|
||||
call void @runtime.nilPanic(i8* undef, i8* null)
|
||||
|
||||
+2
-5
@@ -19,8 +19,6 @@ declare void @"internal/task.start"(i32, i8*, i8*, i8*)
|
||||
|
||||
declare void @runtime.nilPanic(i8*, i8*)
|
||||
|
||||
declare i1 @runtime.isnil(i8*, i8*, i8*)
|
||||
|
||||
declare void @"main$1"(i32, i8*, i8*)
|
||||
|
||||
declare void @"main$2"(i32, i8*, i8*)
|
||||
@@ -38,9 +36,8 @@ define void @runFunc1(i8*, i32, i8, i8* %context, i8* %parentHandle) {
|
||||
entry:
|
||||
%3 = icmp eq i32 %1, 0
|
||||
%4 = select i1 %3, void (i8, i8*, i8*)* null, void (i8, i8*, i8*)* @funcInt8
|
||||
%5 = bitcast void (i8, i8*, i8*)* %4 to i8*
|
||||
%6 = call i1 @runtime.isnil(i8* %5, i8* undef, i8* null)
|
||||
br i1 %6, label %fpcall.nil, label %fpcall.next
|
||||
%5 = icmp eq void (i8, i8*, i8*)* %4, null
|
||||
br i1 %5, label %fpcall.nil, label %fpcall.next
|
||||
|
||||
fpcall.nil:
|
||||
call void @runtime.nilPanic(i8* undef, i8* null)
|
||||
|
||||
Reference in New Issue
Block a user