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.
Этот коммит содержится в:
Ayke van Laethem 2018-09-13 20:48:23 +02:00
родитель 9cd7c7f0ba
коммит 5b3ef2c02f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -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
} }
} }