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.
This commit is contained in:
Ayke van Laethem
2018-09-13 20:48:23 +02:00
parent 9cd7c7f0ba
commit 5b3ef2c02f
-1
View File
@@ -2345,7 +2345,6 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
} else {
fn := c.mod.NamedFunction("runtime.interfaceTypeAssert")
c.builder.CreateCall(fn, []llvm.Value{commaOk}, "")
c.builder.CreateUnreachable()
return undef, nil
}
}