Skip to content

Commit

Permalink
Reintroduce the early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Sep 6, 2017
1 parent 02fb1b0 commit 5bb870f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/librustc_mir/transform/inline.rs
Expand Up @@ -606,19 +606,24 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
_location: Location) {
if *local == RETURN_POINTER {
match self.destination {
Lvalue::Local(l) => *local = l,
Lvalue::Local(l) => {
*local = l;
return;
},
ref lval => bug!("Return lvalue is {:?}, not local", lval)
}
}
let idx = local.index() - 1;
if idx < self.args.len() {
match self.args[idx] {
Operand::Consume(Lvalue::Local(l)) => *local = l,
Operand::Consume(Lvalue::Local(l)) => {
*local = l;
return;
},
ref op => bug!("Arg operand `{:?}` is {:?}, not local", idx, op)
}
} else {
*local = self.local_map[Local::new(idx - self.args.len())];
}
*local = self.local_map[Local::new(idx - self.args.len())];
}

fn visit_lvalue(&mut self,
Expand Down

0 comments on commit 5bb870f

Please sign in to comment.