diff options
| author | Vadim Chugunov <vadimcn@gmail.com> | 2013-06-10 12:32:12 -0700 |
|---|---|---|
| committer | Vadim Chugunov <vadimcn@gmail.com> | 2013-06-17 08:41:23 -0700 |
| commit | 1079e41143e2f94fc0f969b967aaf89b2f4448a2 (patch) | |
| tree | 866fbd44fe4edfce9d7b942eb8eedf61f17fcd7e | |
| parent | 6cc318978796ca67e9350561601dee9931c1da12 (diff) | |
| download | rust-1079e41143e2f94fc0f969b967aaf89b2f4448a2.tar.gz rust-1079e41143e2f94fc0f969b967aaf89b2f4448a2.zip | |
Move "return" basic block after all other function blocks.
| -rw-r--r-- | src/librustc/lib/llvm.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/trans/base.rs | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index a367de059b8..81d5efa6314 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -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] diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 580e7fa1900..70b6c2ba036 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -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); |
