Combine redundant match arm bodies.

This commit is contained in:
Dan Gohman
2017-11-03 16:40:51 -07:00
parent c7f01f88b2
commit acc6d941a3
6 changed files with 14 additions and 14 deletions

View File

@@ -61,7 +61,7 @@ impl ValueConversion {
ValueConversion::IntSplit => ty.half_width().expect("Integer type too small to split"),
ValueConversion::VectorSplit => ty.half_vector().expect("Not a vector"),
ValueConversion::IntBits => Type::int(ty.bits()).expect("Bad integer size"),
ValueConversion::Sext(nty) => nty,
ValueConversion::Sext(nty) |
ValueConversion::Uext(nty) => nty,
}
}
@@ -69,7 +69,7 @@ impl ValueConversion {
/// Is this a split conversion that results in two arguments?
pub fn is_split(self) -> bool {
match self {
ValueConversion::IntSplit => true,
ValueConversion::IntSplit |
ValueConversion::VectorSplit => true,
_ => false,
}

View File

@@ -356,8 +356,8 @@ impl InstructionData {
/// Multi-destination branches like `br_table` return `None`.
pub fn branch_destination(&self) -> Option<Ebb> {
match *self {
InstructionData::Jump { destination, .. } => Some(destination),
InstructionData::Branch { destination, .. } => Some(destination),
InstructionData::Jump { destination, .. } |
InstructionData::Branch { destination, .. } |
InstructionData::BranchIcmp { destination, .. } => Some(destination),
_ => None,
}
@@ -369,8 +369,8 @@ impl InstructionData {
/// Multi-destination branches like `br_table` return `None`.
pub fn branch_destination_mut(&mut self) -> Option<&mut Ebb> {
match *self {
InstructionData::Jump { ref mut destination, .. } => Some(destination),
InstructionData::Branch { ref mut destination, .. } => Some(destination),
InstructionData::Jump { ref mut destination, .. } |
InstructionData::Branch { ref mut destination, .. } |
InstructionData::BranchIcmp { ref mut destination, .. } => Some(destination),
_ => None,
}

View File

@@ -233,7 +233,7 @@ impl<'a> LocationVerifier<'a> {
/// Update diversions to reflect the current instruction and check their consistency.
fn update_diversions(&self, inst: ir::Inst, divert: &mut RegDiversions) -> Result {
let (arg, src) = match self.func.dfg[inst] {
ir::InstructionData::RegMove { arg, src, .. } => (arg, ir::ValueLoc::Reg(src)),
ir::InstructionData::RegMove { arg, src, .. } |
ir::InstructionData::RegSpill { arg, src, .. } => (arg, ir::ValueLoc::Reg(src)),
ir::InstructionData::RegFill { arg, src, .. } => (arg, ir::ValueLoc::Stack(src)),
_ => return Ok(()),