From 681219b06c140e7fe2fbd49f91754293a855c85f Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 22 Nov 2019 16:47:02 -0800 Subject: [PATCH] Fix bug in LLVM lowering of 'return' when the stack has a float on it. --- lib/llvm-backend/src/code.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 63efc3148..2bf615e7d 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -1412,14 +1412,11 @@ impl FunctionCodeGenerator 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 for LLVMFunctionCodeGenerator { phi.add_incoming(&[(&arg, ¤t_block)]); } + let frame = state.outermost_frame()?; + builder.build_unconditional_branch(frame.br_dest()); + state.reachable = false; }