Fix #911 for -llvm-api backend

This commit is contained in:
gingerBill
2021-04-25 19:19:44 +01:00
parent b8327ad00d
commit 5685a8d885
+1 -1
View File
@@ -3282,7 +3282,7 @@ void lb_end_procedure_body(lbProcedure *p) {
// Make sure every block terminates, and if not, make it unreachable
for (block = first_block; block != nullptr; block = LLVMGetNextBasicBlock(block)) {
LLVMValueRef instr = LLVMGetLastInstruction(block);
if (instr == nullptr) {
if (instr == nullptr || !lb_is_instr_terminating(instr)) {
LLVMPositionBuilderAtEnd(p->builder, block);
LLVMBuildUnreachable(p->builder);
}