compiler: fix unreachable type assert
The unreachable instruction is actually a block terminator so may only be inserted at the end of a basic block. This is not always the case for type asserts, so don't insert this instruction. LLVM will hopefully optimize it anyway when it realizes anything after the panic() call is unreachable.
Этот коммит содержится в:
родитель
9cd7c7f0ba
коммит
5b3ef2c02f
1 изменённых файлов: 0 добавлений и 1 удалений
|
@ -2345,7 +2345,6 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
|
||||||
} else {
|
} else {
|
||||||
fn := c.mod.NamedFunction("runtime.interfaceTypeAssert")
|
fn := c.mod.NamedFunction("runtime.interfaceTypeAssert")
|
||||||
c.builder.CreateCall(fn, []llvm.Value{commaOk}, "")
|
c.builder.CreateCall(fn, []llvm.Value{commaOk}, "")
|
||||||
c.builder.CreateUnreachable()
|
|
||||||
return undef, nil
|
return undef, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче