aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-11-12 10:15:40 -0800
committerGraydon Hoare <[email protected]>2010-11-12 10:15:40 -0800
commit1ff88982fe07b341c79345277f857211eccc5a5e (patch)
tree0ddf8acee13ce5ec93c10747f8f11d7b4fc92f2e /src
parentrustc: Add an annotation to function and type items so that the typechecker c... (diff)
downloadrust-1ff88982fe07b341c79345277f857211eccc5a5e.tar.xz
rust-1ff88982fe07b341c79345277f857211eccc5a5e.zip
Stop translating a block when a sub-statement terminates the llvm bb.
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index bd1836b5..17d1a141 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -1131,6 +1131,11 @@ impure fn trans_block(@block_ctxt cx, &ast.block b) -> result {
for (@ast.stmt s in b.node.stmts) {
r = trans_stmt(bcx, *s);
bcx = r.bcx;
+ // If we hit a terminator, control won't go any further so
+ // we're in dead-code land. Stop here.
+ if (is_terminated(bcx)) {
+ ret r;
+ }
}
bcx = trans_block_cleanups(bcx);