From 5bb870faca71bd139c5c4a00381974f66f29e859 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 6 Sep 2017 12:25:46 +0200 Subject: [PATCH] Reintroduce the early returns --- src/librustc_mir/transform/inline.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index dc27da81978..b2572b2d0ab 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -606,19 +606,24 @@ fn visit_local(&mut self, _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,