mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user