Move "return" basic block after all other function blocks.

This commit is contained in:
Vadim Chugunov 2013-06-10 12:32:12 -07:00
parent 6cc3189787
commit 1079e41143
2 changed files with 8 additions and 0 deletions

View file

@ -966,6 +966,12 @@ pub mod llvm {
-> BasicBlockRef;
#[fast_ffi]
pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
#[fast_ffi]
pub unsafe fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef, MoveAfter: BasicBlockRef);
#[fast_ffi]
pub unsafe fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef, MoveBefore: BasicBlockRef);
/* Operations on instructions */
#[fast_ffi]

View file

@ -1907,6 +1907,8 @@ pub fn trans_closure(ccx: @mut CrateContext,
finish(bcx);
cleanup_and_Br(bcx, bcx_top, fcx.llreturn);
unsafe { llvm::LLVMMoveBasicBlockAfter(fcx.llreturn, bcx.llbb); }
// Insert the mandatory first few basic blocks before lltop.
finish_fn(fcx, lltop);