2016-05-07 19:14:28 +03:00
|
|
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
//! A pass that promotes borrows of constant rvalues.
|
|
|
|
//!
|
|
|
|
//! The rvalues considered constant are trees of temps,
|
|
|
|
//! each with exactly one initialization, and holding
|
|
|
|
//! a constant value with no interior mutability.
|
|
|
|
//! They are placed into a new MIR constant body in
|
|
|
|
//! `promoted` and the borrow rvalue is replaced with
|
|
|
|
//! a `Literal::Promoted` using the index into `promoted`
|
|
|
|
//! of that constant MIR.
|
|
|
|
//!
|
|
|
|
//! This pass assumes that every use is dominated by an
|
|
|
|
//! initialization and can otherwise silence errors, if
|
|
|
|
//! move analysis runs after promotion on broken MIR.
|
|
|
|
|
|
|
|
use rustc::mir::repr::*;
|
|
|
|
use rustc::mir::visit::{LvalueContext, MutVisitor, Visitor};
|
2016-06-05 19:38:22 +03:00
|
|
|
use rustc::mir::traversal::ReversePostorder;
|
2016-05-07 19:14:28 +03:00
|
|
|
use rustc::ty::{self, TyCtxt};
|
2016-06-21 18:08:13 -04:00
|
|
|
use syntax_pos::Span;
|
2016-05-07 19:14:28 +03:00
|
|
|
|
|
|
|
use build::Location;
|
|
|
|
|
2016-06-07 17:28:36 +03:00
|
|
|
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
|
|
|
|
2016-05-07 19:14:28 +03:00
|
|
|
use std::mem;
|
|
|
|
|
|
|
|
/// State of a temporary during collection and promotion.
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
|
|
|
pub enum TempState {
|
|
|
|
/// No references to this temp.
|
|
|
|
Undefined,
|
|
|
|
/// One direct assignment and any number of direct uses.
|
|
|
|
/// A borrow of this temp is promotable if the assigned
|
|
|
|
/// value is qualified as constant.
|
|
|
|
Defined {
|
|
|
|
location: Location,
|
|
|
|
uses: usize
|
|
|
|
},
|
|
|
|
/// Any other combination of assignments/uses.
|
|
|
|
Unpromotable,
|
|
|
|
/// This temp was part of an rvalue which got extracted
|
|
|
|
/// during promotion and needs cleanup.
|
|
|
|
PromotedOut
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TempState {
|
|
|
|
pub fn is_promotable(&self) -> bool {
|
|
|
|
if let TempState::Defined { uses, .. } = *self {
|
|
|
|
uses > 0
|
|
|
|
} else {
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// A "root candidate" for promotion, which will become the
|
|
|
|
/// returned value in a promoted MIR, unless it's a subset
|
|
|
|
/// of a larger candidate.
|
|
|
|
pub enum Candidate {
|
|
|
|
/// Borrow of a constant temporary.
|
|
|
|
Ref(Location),
|
|
|
|
|
|
|
|
/// Array of indices found in the third argument of
|
|
|
|
/// a call to one of the simd_shuffleN intrinsics.
|
|
|
|
ShuffleIndices(BasicBlock)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TempCollector {
|
2016-06-07 17:28:36 +03:00
|
|
|
temps: IndexVec<Temp, TempState>,
|
2016-05-07 19:14:28 +03:00
|
|
|
location: Location,
|
|
|
|
span: Span
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> Visitor<'tcx> for TempCollector {
|
|
|
|
fn visit_lvalue(&mut self, lvalue: &Lvalue<'tcx>, context: LvalueContext) {
|
|
|
|
self.super_lvalue(lvalue, context);
|
|
|
|
if let Lvalue::Temp(index) = *lvalue {
|
|
|
|
// Ignore drops, if the temp gets promoted,
|
|
|
|
// then it's constant and thus drop is noop.
|
|
|
|
if let LvalueContext::Drop = context {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-06-07 17:28:36 +03:00
|
|
|
let temp = &mut self.temps[index];
|
2016-05-07 19:14:28 +03:00
|
|
|
if *temp == TempState::Undefined {
|
|
|
|
match context {
|
|
|
|
LvalueContext::Store |
|
|
|
|
LvalueContext::Call => {
|
|
|
|
*temp = TempState::Defined {
|
|
|
|
location: self.location,
|
|
|
|
uses: 0
|
|
|
|
};
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_ => { /* mark as unpromotable below */ }
|
|
|
|
}
|
|
|
|
} else if let TempState::Defined { ref mut uses, .. } = *temp {
|
|
|
|
match context {
|
|
|
|
LvalueContext::Borrow {..} |
|
|
|
|
LvalueContext::Consume |
|
|
|
|
LvalueContext::Inspect => {
|
|
|
|
*uses += 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_ => { /* mark as unpromotable below */ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*temp = TempState::Unpromotable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-07 19:21:56 +03:00
|
|
|
fn visit_source_info(&mut self, source_info: &SourceInfo) {
|
|
|
|
self.span = source_info.span;
|
|
|
|
}
|
|
|
|
|
2016-05-07 19:14:28 +03:00
|
|
|
fn visit_statement(&mut self, bb: BasicBlock, statement: &Statement<'tcx>) {
|
|
|
|
assert_eq!(self.location.block, bb);
|
|
|
|
self.super_statement(bb, statement);
|
|
|
|
self.location.statement_index += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn visit_basic_block_data(&mut self, bb: BasicBlock, data: &BasicBlockData<'tcx>) {
|
|
|
|
self.location.statement_index = 0;
|
|
|
|
self.location.block = bb;
|
|
|
|
self.super_basic_block_data(bb, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-07 17:28:36 +03:00
|
|
|
pub fn collect_temps(mir: &Mir, rpo: &mut ReversePostorder) -> IndexVec<Temp, TempState> {
|
2016-05-07 19:14:28 +03:00
|
|
|
let mut collector = TempCollector {
|
2016-06-07 17:28:36 +03:00
|
|
|
temps: IndexVec::from_elem(TempState::Undefined, &mir.temp_decls),
|
2016-05-07 19:14:28 +03:00
|
|
|
location: Location {
|
|
|
|
block: START_BLOCK,
|
|
|
|
statement_index: 0
|
|
|
|
},
|
|
|
|
span: mir.span
|
|
|
|
};
|
|
|
|
for (bb, data) in rpo {
|
|
|
|
collector.visit_basic_block_data(bb, data);
|
|
|
|
}
|
|
|
|
collector.temps
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Promoter<'a, 'tcx: 'a> {
|
|
|
|
source: &'a mut Mir<'tcx>,
|
|
|
|
promoted: Mir<'tcx>,
|
2016-06-07 17:28:36 +03:00
|
|
|
temps: &'a mut IndexVec<Temp, TempState>,
|
2016-05-07 19:14:28 +03:00
|
|
|
|
|
|
|
/// If true, all nested temps are also kept in the
|
|
|
|
/// source MIR, not moved to the promoted MIR.
|
|
|
|
keep_original: bool
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|
|
|
fn new_block(&mut self) -> BasicBlock {
|
2016-06-07 21:20:50 +03:00
|
|
|
let span = self.promoted.span;
|
|
|
|
self.promoted.basic_blocks_mut().push(BasicBlockData {
|
2016-05-07 19:14:28 +03:00
|
|
|
statements: vec![],
|
|
|
|
terminator: Some(Terminator {
|
2016-06-07 19:21:56 +03:00
|
|
|
source_info: SourceInfo {
|
2016-06-07 21:20:50 +03:00
|
|
|
span: span,
|
2016-06-07 19:21:56 +03:00
|
|
|
scope: ARGUMENT_VISIBILITY_SCOPE
|
|
|
|
},
|
2016-05-07 19:14:28 +03:00
|
|
|
kind: TerminatorKind::Return
|
|
|
|
}),
|
|
|
|
is_cleanup: false
|
2016-06-07 17:28:36 +03:00
|
|
|
})
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn assign(&mut self, dest: Lvalue<'tcx>, rvalue: Rvalue<'tcx>, span: Span) {
|
2016-06-07 21:20:50 +03:00
|
|
|
let last = self.promoted.basic_blocks().last().unwrap();
|
|
|
|
let data = &mut self.promoted[last];
|
2016-05-07 19:14:28 +03:00
|
|
|
data.statements.push(Statement {
|
2016-06-07 19:21:56 +03:00
|
|
|
source_info: SourceInfo {
|
|
|
|
span: span,
|
|
|
|
scope: ARGUMENT_VISIBILITY_SCOPE
|
|
|
|
},
|
2016-05-07 19:14:28 +03:00
|
|
|
kind: StatementKind::Assign(dest, rvalue)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Copy the initialization of this temp to the
|
|
|
|
/// promoted MIR, recursing through temps.
|
2016-06-07 17:28:36 +03:00
|
|
|
fn promote_temp(&mut self, temp: Temp) -> Temp {
|
2016-05-07 19:14:28 +03:00
|
|
|
let old_keep_original = self.keep_original;
|
2016-06-07 17:28:36 +03:00
|
|
|
let (bb, stmt_idx) = match self.temps[temp] {
|
2016-05-07 19:14:28 +03:00
|
|
|
TempState::Defined {
|
|
|
|
location: Location { block, statement_index },
|
|
|
|
uses
|
|
|
|
} if uses > 0 => {
|
|
|
|
if uses > 1 {
|
|
|
|
self.keep_original = true;
|
|
|
|
}
|
|
|
|
(block, statement_index)
|
|
|
|
}
|
2016-06-07 17:28:36 +03:00
|
|
|
state => {
|
|
|
|
span_bug!(self.promoted.span, "{:?} not promotable: {:?}",
|
|
|
|
temp, state);
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
if !self.keep_original {
|
2016-06-07 17:28:36 +03:00
|
|
|
self.temps[temp] = TempState::PromotedOut;
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
let no_stmts = self.source[bb].statements.len();
|
|
|
|
|
|
|
|
// First, take the Rvalue or Call out of the source MIR,
|
|
|
|
// or duplicate it, depending on keep_original.
|
|
|
|
let (mut rvalue, mut call) = (None, None);
|
2016-06-07 19:21:56 +03:00
|
|
|
let source_info = if stmt_idx < no_stmts {
|
2016-05-07 19:14:28 +03:00
|
|
|
let statement = &mut self.source[bb].statements[stmt_idx];
|
2016-08-04 16:14:33 -07:00
|
|
|
let mut rhs = match statement.kind {
|
|
|
|
StatementKind::Assign(_, ref mut rhs) => rhs,
|
|
|
|
StatementKind::SetDiscriminant{ .. } =>
|
|
|
|
span_bug!(statement.source_info.span,
|
|
|
|
"cannot promote SetDiscriminant {:?}",
|
|
|
|
statement),
|
|
|
|
};
|
2016-05-07 19:14:28 +03:00
|
|
|
if self.keep_original {
|
|
|
|
rvalue = Some(rhs.clone());
|
|
|
|
} else {
|
|
|
|
let unit = Rvalue::Aggregate(AggregateKind::Tuple, vec![]);
|
|
|
|
rvalue = Some(mem::replace(rhs, unit));
|
|
|
|
}
|
2016-06-07 19:21:56 +03:00
|
|
|
statement.source_info
|
2016-05-07 19:14:28 +03:00
|
|
|
} else if self.keep_original {
|
|
|
|
let terminator = self.source[bb].terminator().clone();
|
|
|
|
call = Some(terminator.kind);
|
2016-06-07 19:21:56 +03:00
|
|
|
terminator.source_info
|
2016-05-07 19:14:28 +03:00
|
|
|
} else {
|
|
|
|
let terminator = self.source[bb].terminator_mut();
|
|
|
|
let target = match terminator.kind {
|
|
|
|
TerminatorKind::Call {
|
|
|
|
destination: ref mut dest @ Some(_),
|
|
|
|
ref mut cleanup, ..
|
|
|
|
} => {
|
|
|
|
// No cleanup necessary.
|
|
|
|
cleanup.take();
|
|
|
|
|
|
|
|
// We'll put a new destination in later.
|
|
|
|
dest.take().unwrap().1
|
|
|
|
}
|
|
|
|
ref kind => {
|
2016-06-07 19:21:56 +03:00
|
|
|
span_bug!(terminator.source_info.span, "{:?} not promotable", kind);
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
call = Some(mem::replace(&mut terminator.kind, TerminatorKind::Goto {
|
|
|
|
target: target
|
|
|
|
}));
|
2016-06-07 19:21:56 +03:00
|
|
|
terminator.source_info
|
2016-05-07 19:14:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// Then, recurse for components in the Rvalue or Call.
|
|
|
|
if stmt_idx < no_stmts {
|
|
|
|
self.visit_rvalue(rvalue.as_mut().unwrap());
|
|
|
|
} else {
|
|
|
|
self.visit_terminator_kind(bb, call.as_mut().unwrap());
|
|
|
|
}
|
|
|
|
|
2016-06-07 17:28:36 +03:00
|
|
|
let new_temp = self.promoted.temp_decls.push(TempDecl {
|
|
|
|
ty: self.source.temp_decls[temp].ty
|
2016-05-07 19:14:28 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// Inject the Rvalue or Call into the promoted MIR.
|
|
|
|
if stmt_idx < no_stmts {
|
2016-06-07 17:28:36 +03:00
|
|
|
self.assign(Lvalue::Temp(new_temp), rvalue.unwrap(), source_info.span);
|
2016-05-07 19:14:28 +03:00
|
|
|
} else {
|
2016-06-07 21:20:50 +03:00
|
|
|
let last = self.promoted.basic_blocks().last().unwrap();
|
2016-05-07 19:14:28 +03:00
|
|
|
let new_target = self.new_block();
|
|
|
|
let mut call = call.unwrap();
|
|
|
|
match call {
|
|
|
|
TerminatorKind::Call { ref mut destination, ..} => {
|
2016-06-07 17:28:36 +03:00
|
|
|
*destination = Some((Lvalue::Temp(new_temp), new_target));
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
_ => bug!()
|
|
|
|
}
|
2016-06-07 21:20:50 +03:00
|
|
|
let terminator = self.promoted[last].terminator_mut();
|
2016-06-07 19:21:56 +03:00
|
|
|
terminator.source_info.span = source_info.span;
|
2016-05-07 19:14:28 +03:00
|
|
|
terminator.kind = call;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Restore the old duplication state.
|
|
|
|
self.keep_original = old_keep_original;
|
|
|
|
|
2016-06-07 17:28:36 +03:00
|
|
|
new_temp
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn promote_candidate(mut self, candidate: Candidate) {
|
|
|
|
let span = self.promoted.span;
|
|
|
|
let new_operand = Operand::Constant(Constant {
|
|
|
|
span: span,
|
|
|
|
ty: self.promoted.return_ty.unwrap(),
|
|
|
|
literal: Literal::Promoted {
|
2016-06-07 17:28:36 +03:00
|
|
|
index: Promoted::new(self.source.promoted.len())
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
let mut rvalue = match candidate {
|
|
|
|
Candidate::Ref(Location { block: bb, statement_index: stmt_idx }) => {
|
2016-08-04 16:14:33 -07:00
|
|
|
let ref mut statement = self.source[bb].statements[stmt_idx];
|
|
|
|
match statement.kind {
|
2016-05-07 19:14:28 +03:00
|
|
|
StatementKind::Assign(_, ref mut rvalue) => {
|
|
|
|
mem::replace(rvalue, Rvalue::Use(new_operand))
|
|
|
|
}
|
2016-08-04 16:14:33 -07:00
|
|
|
StatementKind::SetDiscriminant{ .. } => {
|
|
|
|
span_bug!(statement.source_info.span,
|
|
|
|
"cannot promote SetDiscriminant {:?}",
|
|
|
|
statement);
|
|
|
|
}
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Candidate::ShuffleIndices(bb) => {
|
|
|
|
match self.source[bb].terminator_mut().kind {
|
|
|
|
TerminatorKind::Call { ref mut args, .. } => {
|
|
|
|
Rvalue::Use(mem::replace(&mut args[2], new_operand))
|
|
|
|
}
|
|
|
|
_ => bug!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
self.visit_rvalue(&mut rvalue);
|
|
|
|
self.assign(Lvalue::ReturnPointer, rvalue, span);
|
|
|
|
self.source.promoted.push(self.promoted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Replaces all temporaries with their promoted counterparts.
|
|
|
|
impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
|
|
|
|
fn visit_lvalue(&mut self, lvalue: &mut Lvalue<'tcx>, context: LvalueContext) {
|
2016-06-07 17:28:36 +03:00
|
|
|
if let Lvalue::Temp(ref mut temp) = *lvalue {
|
|
|
|
*temp = self.promote_temp(*temp);
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
self.super_lvalue(lvalue, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-03 04:56:42 +03:00
|
|
|
pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>,
|
2016-05-03 05:23:22 +03:00
|
|
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
2016-06-07 17:28:36 +03:00
|
|
|
mut temps: IndexVec<Temp, TempState>,
|
2016-05-03 04:56:42 +03:00
|
|
|
candidates: Vec<Candidate>) {
|
2016-05-07 19:14:28 +03:00
|
|
|
// Visit candidates in reverse, in case they're nested.
|
|
|
|
for candidate in candidates.into_iter().rev() {
|
|
|
|
let (span, ty) = match candidate {
|
|
|
|
Candidate::Ref(Location { block: bb, statement_index: stmt_idx }) => {
|
|
|
|
let statement = &mir[bb].statements[stmt_idx];
|
2016-08-04 16:14:33 -07:00
|
|
|
let dest = match statement.kind {
|
|
|
|
StatementKind::Assign(ref dest, _) => dest,
|
|
|
|
StatementKind::SetDiscriminant{ .. } =>
|
|
|
|
panic!("cannot promote SetDiscriminant"),
|
|
|
|
};
|
2016-05-07 19:14:28 +03:00
|
|
|
if let Lvalue::Temp(index) = *dest {
|
2016-06-07 17:28:36 +03:00
|
|
|
if temps[index] == TempState::PromotedOut {
|
2016-05-07 19:14:28 +03:00
|
|
|
// Already promoted.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2016-08-05 15:59:51 -07:00
|
|
|
(statement.source_info.span, dest.ty(mir, tcx).to_ty(tcx))
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
Candidate::ShuffleIndices(bb) => {
|
|
|
|
let terminator = mir[bb].terminator();
|
|
|
|
let ty = match terminator.kind {
|
|
|
|
TerminatorKind::Call { ref args, .. } => {
|
2016-08-08 13:35:10 -07:00
|
|
|
args[2].ty(mir, tcx)
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
_ => {
|
2016-06-07 19:21:56 +03:00
|
|
|
span_bug!(terminator.source_info.span,
|
2016-05-07 19:14:28 +03:00
|
|
|
"expected simd_shuffleN call to promote");
|
|
|
|
}
|
|
|
|
};
|
2016-06-07 19:21:56 +03:00
|
|
|
(terminator.source_info.span, ty)
|
2016-05-07 19:14:28 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let mut promoter = Promoter {
|
|
|
|
source: mir,
|
2016-06-07 21:20:50 +03:00
|
|
|
promoted: Mir::new(
|
|
|
|
IndexVec::new(),
|
|
|
|
Some(VisibilityScopeData {
|
2016-05-07 19:14:28 +03:00
|
|
|
span: span,
|
|
|
|
parent_scope: None
|
2016-06-07 17:28:36 +03:00
|
|
|
}).into_iter().collect(),
|
2016-06-07 21:20:50 +03:00
|
|
|
IndexVec::new(),
|
|
|
|
ty::FnConverging(ty),
|
|
|
|
IndexVec::new(),
|
|
|
|
IndexVec::new(),
|
|
|
|
IndexVec::new(),
|
|
|
|
vec![],
|
|
|
|
span
|
|
|
|
),
|
2016-05-07 19:14:28 +03:00
|
|
|
temps: &mut temps,
|
|
|
|
keep_original: false
|
|
|
|
};
|
|
|
|
assert_eq!(promoter.new_block(), START_BLOCK);
|
|
|
|
promoter.promote_candidate(candidate);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Eliminate assignments to, and drops of promoted temps.
|
2016-06-07 17:28:36 +03:00
|
|
|
let promoted = |index: Temp| temps[index] == TempState::PromotedOut;
|
2016-06-07 21:20:50 +03:00
|
|
|
for block in mir.basic_blocks_mut() {
|
2016-05-07 19:14:28 +03:00
|
|
|
block.statements.retain(|statement| {
|
|
|
|
match statement.kind {
|
|
|
|
StatementKind::Assign(Lvalue::Temp(index), _) => {
|
|
|
|
!promoted(index)
|
|
|
|
}
|
|
|
|
_ => true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
let terminator = block.terminator_mut();
|
|
|
|
match terminator.kind {
|
2016-05-17 01:06:52 +03:00
|
|
|
TerminatorKind::Drop { location: Lvalue::Temp(index), target, .. } => {
|
2016-05-07 19:14:28 +03:00
|
|
|
if promoted(index) {
|
|
|
|
terminator.kind = TerminatorKind::Goto {
|
|
|
|
target: target
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|