Fix bug in LLVM lowering of 'return' when the stack has a float on it.

This commit is contained in:
Nick Lewycky 2019-11-22 16:47:02 -08:00
parent 85666fc522
commit 681219b06c

View File

@ -1412,14 +1412,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
}
}
Operator::Return => {
let frame = state.outermost_frame()?;
let current_block = builder.get_insert_block().ok_or(BinaryReaderError {
message: "not currently in a block",
offset: -1isize as usize,
})?;
builder.build_unconditional_branch(frame.br_dest());
let frame = state.outermost_frame()?;
for phi in frame.phis().to_vec().iter() {
let (arg, info) = state.pop1_extra()?;
@ -1427,6 +1424,9 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
phi.add_incoming(&[(&arg, &current_block)]);
}
let frame = state.outermost_frame()?;
builder.build_unconditional_branch(frame.br_dest());
state.reachable = false;
}