Skip to content

Commit

Permalink
Remove redundant nested array checks
Browse files Browse the repository at this point in the history
Already checked by 8093f11 - ignore arrays in operands
  • Loading branch information
tesuji committed Jul 14, 2024
1 parent 3abc321 commit 8672700
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
AggregateTy::Array => {
assert!(fields.len() > 0);
let field_ty = fields[0].layout.ty;
// FIXME: Ignore nested arrays, because arrays is large. Nested arrays are rarer and bigger
// while we already process 1-dimension arrays, which is enough?
if field_ty.is_array() {
trace!(
"ignoring nested array of type: [{field_ty}; {len}]",
len = fields.len(),
);
return None;
}
Ty::new_array(self.tcx, field_ty, fields.len() as u64)
}
AggregateTy::Tuple => {
Expand Down Expand Up @@ -899,13 +890,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}

let (mut ty, variant_index) = match *kind {
AggregateKind::Array(ty) => {
AggregateKind::Array(_) => {
assert!(!field_ops.is_empty());
// FIXME: Ignore nested arrays, because arrays is large. Nested arrays are rarer and bigger
// while we already process 1-dimension arrays, which is enough?
if ty.is_array() {
return None;
}
(AggregateTy::Array, FIRST_VARIANT)
}
AggregateKind::Tuple => {
Expand Down

0 comments on commit 8672700

Please sign in to comment.